It could be be very interesting if the behavior of comment uncomment function was:
* If nothing is commented in the selection => comment selection
* If there thing which are commented and things uncommented : add a level of comment (so for example code will be comment be an other level of comment is add before the comment inside the code)
* If everything is commented, the function uncomment the selection.
What users think about that and what Don, do you think about this specification of the comment/uncomment function?
Thanks a lot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was about to make the very same suggestion when I saw this open thread.
I am also used to comment whole blocks of code on the fly, in C or ASM (that does not even have streamed comments as an alternate solution), and since my code is already commented in many parts, the default CTRL-Q behaviour is a bit annoying, to say the least.
Steakhacher solution (with mmtsuchi addendum) would be the ideal one.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I much prefer comments being at the beginning of the lines, so they are all lined up. If some are indented different widths it doesn't look very good.
I also agree with the OP. The 'alternate commented lines' functionality is nice and should be kept but IMO the default is much better as two functions, comment and uncomment. Because I am a good programmer who comments on what my code does ;) if I want to comment several lines, currently my 'this part does ...'-like comments get uncommented, which obviously isn't helpful!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
+1 for the 2 "dreams".
- Comment all lines when bloc content is already partially commented is useful to keep a documented part of code during the test of another programming solution.
- I like to comment at the beginning during debug sessions to get a quick vision of what's commented because this is a comment line, and what is a commented code keeped for recall or temporarly for testing.
Jerome
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 2 features I use very often and that I've added with the software autohotkey :
- alt Q : comment current line
- alt shift Q : uncomment current line
no need to select text !
We can also implement it using only one hotkey and detect if the line is already commented
And we can combine this with other suggested features by detecting if text is selected !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Excuse me, but I have not understand if you are doing this with the default installation of notepad++ or if you have added an existing plugin or if you have developed your own plugin.
Please explain the method to do what you explain, I am very interesting.
Thanks for your answer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use the autohotkey software : http://www.autohotkey.com/
It allows you to launch special script on hotkey.
It has many features, but the script need to run permanently as a process.
The script file is a .ahk file that can be compiled as a little .exe that work anywhere (on windows).
Here is a sample of my autohotkey script :
---------------------------------------------------------------------
#CommentFlag // ; activate commenting with // instead of ;
ctrlAltHome := "{End}{Home}{Home}{Home}" // go to line start after tabulations (it's a variable)
//ctrl : insert a line before, with /*
^q::
Send ^d%ctrlAltHome%+{End}0{Backspace}{SC135}* // ^d is the hotkey for "duplicate line"
return
//ctrl shift : insert a line before, with */
^+q::
Send {End}{Enter}*{SC135}
return
//alt : comment the line with //
!q::Send %ctrlAltHome%{SC135}{SC135}{Space}
//alt shift : uncomment line with //
!+q::Send %ctrlAltHome%^{delete}
//ctrl alt : duplicate and comment line
^!q::Send ^d%ctrlAltHome%{SC135}{SC135}{Space}{Down}{Home}
---------------------------------------------------------------------
^ means ctrl
+ means shift
! means alt
SC135 means /
The comment symbols are for C++ users.
This hotkeys works also for visual studio and even firefox ! (except those that uses ^d)
you can also make this sort of things :
---------------------------------------------------------------------
^+c:: // ctrl shift c
IfWinActive Firefox
{ Send {F6}^c{Tab} // copy the adress
}
return
---------------------------------------------------------------------
(even those separating lines are writing with autohotkey : alt e)
Hi
It could be be very interesting if the behavior of comment uncomment function was:
* If nothing is commented in the selection => comment selection
* If there thing which are commented and things uncommented : add a level of comment (so for example code will be comment be an other level of comment is add before the comment inside the code)
* If everything is commented, the function uncomment the selection.
What users think about that and what Don, do you think about this specification of the comment/uncomment function?
Thanks a lot
Another +1 for this dream...
I was about to make the very same suggestion when I saw this open thread.
I am also used to comment whole blocks of code on the fly, in C or ASM (that does not even have streamed comments as an alternate solution), and since my code is already commented in many parts, the default CTRL-Q behaviour is a bit annoying, to say the least.
Steakhacher solution (with mmtsuchi addendum) would be the ideal one.
Thanks
I may add that comment characters should be at the begining of commented lines.
Yes, I much prefer comments being at the beginning of the lines, so they are all lined up. If some are indented different widths it doesn't look very good.
I also agree with the OP. The 'alternate commented lines' functionality is nice and should be kept but IMO the default is much better as two functions, comment and uncomment. Because I am a good programmer who comments on what my code does ;) if I want to comment several lines, currently my 'this part does ...'-like comments get uncommented, which obviously isn't helpful!
+1 for the 2 "dreams".
- Comment all lines when bloc content is already partially commented is useful to keep a documented part of code during the test of another programming solution.
- I like to comment at the beginning during debug sessions to get a quick vision of what's commented because this is a comment line, and what is a commented code keeped for recall or temporarly for testing.
Jerome
The 2 features I use very often and that I've added with the software autohotkey :
- alt Q : comment current line
- alt shift Q : uncomment current line
no need to select text !
We can also implement it using only one hotkey and detect if the line is already commented
And we can combine this with other suggested features by detecting if text is selected !
Hi
Excuse me, but I have not understand if you are doing this with the default installation of notepad++ or if you have added an existing plugin or if you have developed your own plugin.
Please explain the method to do what you explain, I am very interesting.
Thanks for your answer
I use the autohotkey software : http://www.autohotkey.com/
It allows you to launch special script on hotkey.
It has many features, but the script need to run permanently as a process.
The script file is a .ahk file that can be compiled as a little .exe that work anywhere (on windows).
Here is a sample of my autohotkey script :
---------------------------------------------------------------------
#CommentFlag // ; activate commenting with // instead of ;
ctrlAltHome := "{End}{Home}{Home}{Home}" // go to line start after tabulations (it's a variable)
//ctrl : insert a line before, with /*
^q::
Send ^d%ctrlAltHome%+{End}0{Backspace}{SC135}* // ^d is the hotkey for "duplicate line"
return
//ctrl shift : insert a line before, with */
^+q::
Send {End}{Enter}*{SC135}
return
//alt : comment the line with //
!q::Send %ctrlAltHome%{SC135}{SC135}{Space}
//alt shift : uncomment line with //
!+q::Send %ctrlAltHome%^{delete}
//ctrl alt : duplicate and comment line
^!q::Send ^d%ctrlAltHome%{SC135}{SC135}{Space}{Down}{Home}
---------------------------------------------------------------------
^ means ctrl
+ means shift
! means alt
SC135 means /
The comment symbols are for C++ users.
This hotkeys works also for visual studio and even firefox ! (except those that uses ^d)
you can also make this sort of things :
---------------------------------------------------------------------
^+c:: // ctrl shift c
IfWinActive Firefox
{ Send {F6}^c{Tab} // copy the adress
}
return
---------------------------------------------------------------------
(even those separating lines are writing with autohotkey : alt e)
I've many many hotkeys like those.
I use autohotkeys to emulate my personalized dvorak keyboard too.
Infos on dvorak : http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
Comic explaining the story of qwerty and dvorak : http://dvzine.org/zine/01-toc.html