gd" go to definition of variable
:%s/" beginning of a replace...
Ctrl-r /" inserts the last word searched into the command, so what "gd" found
/newname/gc" finish the replace command, g=global replace, c=confirm each replace
Save a character going to a line:
instead of using :42<enter> to go to line 42, can use 42GAuto-indent: =
Go to last file: Ctrl-^
Abbreviations: put this in your ~/.vimrc
iab cmain int main() {
\<CR> return 0;
\<CR>}
Insert the contents of a file:
:r <filename>I like to have a ~/gitmessage.txt which has a template I like, then when I do git commit all I have to do is:
:r ~/gitmessage.txt
Vim + Ctags:Ctags link usages and definitions so you can navigate through code like in an IDE without the bloat of an IDE. Works best with C, but works pretty well with any language with C-like syntax (and more).
Goto tag (definition) of what's under cursor: Ctrl-]
Go back: Ctrl-t
Open tag in a preview: Ctrl-w
:tag <tag> " go to tag, like:
:tag someFunction
:tag SOME_CONSTANT