Friday, November 11, 2011

Favorite keyboard actions

NAVIGATION



Ctrl + – (hyphen) Cycle through previous cursor positions

Ctrl + Shift + - Cycle in the opposite direction



                  Cycling through cursor positions is a great way to save time moving between areas you?re working on. Note that this will actually move you between files you?ve been working in, too.



Ctrl + ] Bounce to matching brace, comment, region or quote, depending on the what?s currently at the cursor.

 
                  This is handy way to jump between the opening and closing marks of a region, quote, or brace set. It?s also a handy way to check if you?ve got your braces properly matched. Another way of doing that would be to format the entire file with Ctrl-A, Ctrl-K, Ctrl-F, but that?s more keystrokes.


BOOKMARKS (Note these are chord key combinations)



Ctrl + K, Ctrl + K Create a bookmark


Ctrl + K, Ctrl + N Bounce to next bookmark


Ctrl + K, Ctrl + P Bounce to previous bookmark


Ctrl + K, Ctrl + L Clear all bookmarks



                    Bookmarks work much like the cursor marks discussed above, but you?re able to control exactly where you want to bounce back and forth between.


FAVORITE NAV TRICK FROM VIM DAYS


Ctrl + G Go to line number (turn on line numbering via Tools -> Options -> Text Editor -> Select your editor -> Display -> Line Numbers)

                     
I use this all the time in Vim since it’s a quick way to jump to a spot where you know the line number, even if it’s just a few lines up on the screen. Hit Ctrl-G, type in a line number and press Enter instead of reaching for the mouse, or hitting the up arrow a bunch of times. I use it even when I’m not certain of the exact line number, but know the general region I want to hit.


OUTLINING



Ctrl + M, Ctrl + M Collapse or expand the block you?re currently in.


Ctrl + M, Ctrl + O Collapse all blocks in the file


Ctrl + M, Ctrl + L Expand all blocks in the file


Ctrl + M, Ctrl + P Stop outlining mode. (Ctrl+M, Ctrl+O resumes)



                    I think the Stop Outline Mode is pretty useless, but I love the other commands. I like clearing off extra cruft from the screen, allowing me to focus on what I?m working in at the moment.


CLIPBOARD RING



Ctrl + Shift + V Cycle through items copied to clipboard


                   The clipboard ring’s a terrific tool for doing mass edits. Move a number of items into the clipboard ring via any Copy or Cut command, then cycle through those items as you’re pasting away.

No comments:

Post a Comment