Editor from Hell
Back, Down, Down, Front, Punch - Come over here!
Vi vs Vim
Command Overview
Creating Files
Vi | Vim | Description |
---|---|---|
:q, :q!, null | :q, :q!, :qa! | Close document, force close, close all |
i, Esc | i, Esc | Insert Mode, Exit Insert Mode |
:w, :w filename.txt, :wq! | :w, :w filename.txt, :wq! | Save file, Save fie with filename, Save and quit |
:e filename.txt | :e filename.txt | Edit existing file |
Navigation
Vi | Vim | Description |
---|---|---|
h,j,k,l (or cursor) | h,j,k,l (or cursor) | left, down, up, right |
w, e | w, e | jump to next word, end of the word |
(, ), {, } | (, ), {, } | Beginning/End of sentence or paragraph |
/query | /query | Replace query with the word you are searching for |
# | # | find instances of word under cursor in document |
:linenumber | :linenumber | Go to line |
Shift+G, double g | Shift+G, double g | Go to end / beginning of file |
Ctrl+f, Ctrl+b | Ctrl+f, Ctrl+b | Next / previous page |
Editing
Vi | Vim | Description |
---|---|---|
d+w, d+), d+d | d+w, d+), d+d | delete word, sentence, line |
u | u | undo |
y+w, y+), y+d | y+w, y+), y+d | copy word, sentence, line |
p | p | paste copied content |
null | Shift+v, Ctrl+v | Select line, select block |
Customization
Vi | Vim | Description |
---|---|---|
null | :set number, :set nonumber | Add/Remove line numbering |
null | :set wrap linebreak | Add soft word wrap |
null | vim -d file1 file2 | Show diff between two text files |