NG NDD Nyy: Handy-Dandy Vim Guide
NG NDD Nyy: Handy-Dandy Vim Guide
Some important vim commands: $ go to end of current line 0 go to beginning of current line ^ go to first non-blank character in the current line G to go to last line nG to go to line n d$ from current position to end of line ndd to delete n lines starting from current line (lines deleted are put in buffer) nyy to yank (copy) n lines starting from curent line into the buffer p to paste whatever is in the buffer below the current line (hence, ndd followed by p mimics a cutand-paste; nyy followed by p mimics a copy-and-paste) P to paste whatever is in the buffer above the current line u to undo previous command x to delete current character (deleted character is put into buffer) And you can create abbreviation (ab) but defining it in .vimrc For example, I have in .vimrc this line: ab main int main(void) So everytime I type main it gets expanded into int main(void) for me. There is one very handy command I use in vim very often (not for programming though): :g/xxx/s//yyy/s to replace all occurences of xxx with yyy in the whole file