vim
Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X.
| Basics |
| v |
visual mode |
| i |
insert mode |
| :w |
Save file |
| :x |
Save and exit |
| :q |
Exit if no changes have been made |
| :q! |
Exit and undo any changes made |
| :set nu |
Display line numbers |
| Navigation |
| h / j / k / l |
left / bottom / top / right |
| gg |
Goto top of doc |
| G |
goto bottom of doc |
| w |
goto next word |
| W |
goto next word past punctuations |
| b |
goto start /back/ of word |
| B |
goto start /back/ of word past punctuations |
| e |
goto end of word |
| { |
Move back one paragraph |
| } |
Move forward one paragraph |
| ^ |
goto the beginning of the line |
| dollar sign |
goto the end of the line |
| G |
goto the nth line |
| % |
Move to the matching bracket |
| Deleting |
| x |
Delete a single character |
| D |
Delete the rest of the line |
| dd |
Delete the entire current line |
| ndw |
Delete the next n words |
| ndd |
Delete the next n lines |
| :x |
yd |
| Cut and Paste |
| p |
Paste the clipboard contents |
| yy |
Yank /copy/ a line |
| yw |
Yank a word |
| y dollar |
Yank to the end of the line |
| Search and Replace |
| /pattern |
Search forward |
| ?pattern |
Search backward |
| n |
Find the next occurrence of pattern |
| :%s/pattern/replace/g |
Replace every occurrence of pattern with replace |