Wednesday, December 27, 2006
I often use vim as the editor when I’m connecting to my hosting
provider…. so I figured I’d put the most common tasks up
here, since I can never remember some of these.
Save / Exit
|:q!||Really quit, don’t just talk about it.|
|:wq||Quit, but save first, cause who really wants to do
something in vim more than once?
|Pretty much the same as the above, but it doesn’t save
if you don’t need to. This makes more sense, and it’s one keystroke
|ESC||Go back to command mode|
|So this is where the gmail keys came from!|
|j||Up one line|
|k||Down one line|
|e||end of the world. I mean word.|
|b||beginning of the word.|
|0||Beginning of a line|
|$||End of a line|
|H||kinda like Home, takes you to the top left|
|L||also means loser, takes you to the bottom of the screen.|
|:88||takes you to line #88. Don’t try this with any line
other than 88.
|i||insert text. This is one of the only keys you need to
|x||delete the character you are standing on. This is the
other character you really need to know.
|cw||delete the current word and start inserting. means “Change Word”. Thanks Quinn!|
|r||overwrite a single character. I like this one.|
|R||replace lots of characters.|
|o||Make a new line below and start insert mode|
|O||Make a new line above and start insert mode|
|a||append right here. You’ll probably use i more.|
|A||Appends at the end of the line. I use this a lot.|
|dd||delete the entire line.|
|9dd||delete 9 lines. This only works for 9 lines. You
couldn’t say, use this to delete 8 lines by doing ’8dd’. No way would
|yy||yank the current line to the clipboard, or
whatever they call it in vim terms.
|5y||yank 5 lines to the clipboard.|
|p||paste the line you just yanked.|
|u||Undo. This app actually has undo? very cool.|
|/pattern||search for the pattern “pattern” Kinda redundant
|n||Works like F3 does in windows, takes you to the next
|N||works like F3 doesn’t in windows, and takes you to the
previous search result.
|%s/stuff/toreplace/g||Replace stuff with toreplace everywhere in the file.|
|G||Go to the end of the file (thanks Q!)|