Tuesday, March 09, 2010

Vim Tips

Very useful  Vi Tips:

* # g* g#        find word under cursor (forwards/backwards) or word completion in insert mode
guu                  lowercase line
gUU                uppercase line
~                     invert case (upper->lower; lower->upper) of current character
'.                      jump to last modification line
`.                     jump to exact spot in last modification line
:reg                 display contents of all registers
:"1p                 paste from register 1
gf                    Open the file under cursor
ctrl+w f          Open the file under cursor and split screen horizontally.
vim -O file1 file2    open file1 and file2 side by side
:command              runs named command
Ctrl+w {left,right,up,down}    move to window
''                        move to previous position
Ctrl+o  move to previous position (recursively, in history)
CTRL-I jump to next location (recursively, in history)

Jumping to diffs:
[c  Jump backwards to the previous start of a change.
]c  Jump forwards to the next start of a change.


No comments: