There's a really nice post that's getting shared all over the intarnets right now, showcasing useful keyboard tricks in various editors, but I thought it missed Notepad++ which does support most of those tricks out of the box.
I decided to list a few quick keyboard tricks in Notepad++ I use daily, and there are really a few cool ones.
Delete whole words
Delete previous word: Control + Backspace
Delete next word: Control + Delete
Actually I think that works in any Windows application since it works right here in my WordPress Write interface.
More power: you can delete from carret to start of line or to end of line adding Shift in the combo:
Delete to start of line: Control + Shift + Backspace
Delete to end of line: Control + Shift + Delete
Duplicate or delete current line
Duplicate current line: Control + D
Delete current line: Control + L
I use the first one pretty often, especially when wanting to test something slightly different: duplicate line, comment first one out and slightly alter second one. Which goes along really well with next trick:
Comment or uncomment one or several lines
Comment or uncomment: Control + Q
That one toggles a leading // in current line or for a line selection. You can also add "stream comments" (ie /* stuff */) with the following key combo:
Add stream comment: Shift + Control + Q
Move that line
Switch current and previous line: Control + T
Move whole line to another place: Shift + Control + Up or Shift + Control + Down
The totally cool stuff is, that second trick works with a multiple line selection. This works great to move an entire small function or CSS declaration.
Column Editing
I've always thought that one was insane :) Pretty usefull if you want to edit several lines of a file where the same text is repeated, such as a CSS file.
Column selection: Alt + Left Click
Where does that code block starts or end? Find matching brace
Go to matching brace : Control + B
Of course the highlighting helps but when the block is taller than your screen, it's not enough. That one is one of my favorites, it makes navigation in if then else or function blocks really easy.
Automatic indentation
Select several lines and move them to the right (indent) or to the left (unindent? outdent?) in a blink
Indent several lines: Tab
Unindent several lines: Shift + Tab
Scroll through the document without using your mouse
Scroll without changing carret position: Control + Up or Control + Down
More !
That's just a few quick and useful keyboard tricks I use all the time, but there are a lot more. Notepad++ has also a gazillion plugins to do just anything you'd think of. The ones I use all the time are Function List (displays a function list in the sidebar, very handy to quickly navigate) and Finger Text, one of the many snippet plugins available.
Shorter URL
Want to share or tweet this post? Please use this short URL: http://ozh.in/vi
Ozh! I have tried to install the "Function List" plugin, but it crashes on me. Notepad++ Plugin Manager has it listed as unstable. Just curious how you got this puppy to work? I actually used this a few years ago when it was stable at the time.
And thanks for the comment/uncomment multiple lines with SHIFT-CTRL-Q! That is a timesaver. On single lines I just double-slash it out, easier for my fingers to do.
Ronnie » Yes, it is listed indeed as unstable and can easily crash. It was a reason why I didn't upgrade Notepad++ for a long time but there's a trick to properly install it. Currently I'm running N++ 6.2 and the function list plugin 2.1, I think that article was what fixed it right for me. HTH!
Outstanding! That did the trick. BTW, the Amdaris website is down right now … was able to pull up a cached version of that article you referenced. Thanks for help Ozh!
Ronnie » hopefully I mirrored it here: https://gist.github.com/4190794 for future reference :)
Ozh! Current rule file for Php is not very good. Daniel Kassner's rule file is almost there. Found another rule file on Git which is much improved and includes rules for CSS also.
I can't get the custom icons to show though. Might be that the image reference is wonked … looking into that.
As with Daniel's version, edit your XML file outside of NPP. The resulting list is very much like Eclipse and Netbeans.
Ronnie » Awesome!
Ozh! Give 'er a try. Even without the fancy icons like the screenshots show, it is more than enough to enhance NPP.
Another buggy thing is when you click inside a function within the editor, it is not being highlighted in the function list panel. That was working with the default PHP rule group. I can live without that … it is just nice to have the list and showing the parameters for the function.
Sir, How can i highlight a particular line & save it in the same manner so that next time when i open i could find in the same highlighted manner as i did last time…..Thank you