NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
venimus
Joined: 17 Feb 2011 Posts: 2
|
Posted: Thu Feb 17, 2011 6:56 pm Post subject: [Resolved] Multiline Comment & Uncomment Macros |
|
|
I know that Netbeans lacks multiline comment feature
However I made 2 macros to do the job, assign to a shortcut
Comment macro:
| Code: | | cut-to-clipboard "/*" paste-from-clipboard "*/" caret-backward caret-backward |
Similar ones already could be found in the internet, I extended it to move the caret inside the comment block, which i think is better.
But I could not find an uncomment macro, so I made one:
Uncomment macro:
Put the carret inside a comment block and press the shortcut
| Code: | | "*/" selection-backward selection-backward find-selection delete-next find-previous "/*" selection-backward selection-backward find-selection find-previous find-previous delete-next find-next delete-next |
However there are some drawbacks (macro commands are too limited for something more reliable):
* those macros destroy the clipboard contents
* uncomment macro works properly ONLY if the caret is inside a comment block and there is no selection, else unpredictable results may appear, use Ctrl+Z if something weird happens
So if you are careful this could save you lots of time.
Hope those are helpful. |
|
| Back to top |
|
 |
Tony Posted via mailing list.
|
Posted: Fri Feb 18, 2011 8:32 am Post subject: [Resolved] Multiline Comment & Uncomment Macros |
|
|
Why did you bother?
The simplest way to accomplish this is to write your comment .. over however
many lines it takes, then hit 'Toggle comment'(Alt/Ctrl-C) with those lines
highlighted.
Tony
-----Original Message-----
From: venimus [mailto:address-removed]
Sent: 17 February 2011 18:57
To: address-removed
Subject: [nbusers] [Resolved] Multiline Comment & Uncomment Macros
I know that Netbeans lacks multiline comment feature
However I made 2 macros to do the job, assign to a shortcut
Comment macro:
Code:
cut-to-clipboard "/*" paste-from-clipboard "*/" caret-backward
caret-backward
Similar ones already could be found in the internet, I extended it to move
the caret inside the comment block, which i think is better.
But I could not find an uncomment macro, so I made one:
Uncomment macro:
Put the carret inside a comment block and press the shortcut
Code:
"*/" selection-backward selection-backward find-selection delete-next
find-previous "/*" selection-backward selection-backward find-selection
find-previous find-previous delete-next find-next delete-next
However there are some drawbacks (macro commands are too limited for
something more reliable):
* those macros destroy the clipboard contents
* uncomment macro works properly ONLY if the caret is inside a comment block
and there is no selection, else unpredictable results may appear, use Ctrl+Z
if something weird happens
So if you are careful this could save you lots of time.
Hope those are helpful. |
|
| Back to top |
|
 |
venimus
Joined: 17 Feb 2011 Posts: 2
|
Posted: Fri Feb 18, 2011 10:11 am Post subject: |
|
|
Because block comments have their advantages.
Please, the topic is not about line vs. block comments |
|
| Back to top |
|
 |
|
|
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 You can attach files in this forum You can download files in this forum
|
|