Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

macro for commenting/uncommenting multiple lines

 
Post new topic   Reply to topic    Community Forum Index -> Tips
View previous topic :: View next topic  
Author Message
troels_kn



Joined: 28 Oct 2005
Posts: 32

PostPosted: Sun May 20, 2007 6:58 pm    Post subject: macro for commenting/uncommenting multiple lines Reply with quote

In C-like languages (Including PHP and Java), you often have to comment out a block of text, and you can't always use the block-type comments /* */ because they don't nest. For this purpose, I have a macro, which comments out the selection, and a counterpart, which does the opposite.

To implement:

Select some lines of text.
(begin macro)
From the menu select: Search > Replace
[X] Regular expressions
Scope: Selected text
Find what: ^
Replace with: //
Press 'Replace All'
Press 'Close'
(end macro)

For the opposite:
Select some lines of text (presumably the same as above).
(begin macro)
From the menu select: Search > Replace
[X] Regular expressions
Scope: Selected text
Find what: ^//
Replace with:
Press 'Replace All'
Press 'Close'
(end macro)

I have these macros mapped to Ctrl+(The key above Tab) and Ctrl+Shift+(The key above Tab).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Tips All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB