VI Tips
Command | Description |
---|---|
/ | Search.n for next, N for previous |
? | Search backwards |
:%s/OLD/NEW/g | Replace all OLD with NEW |
dgg | Removes all lines |
:set ic | set case insesitive for search |
:set ft=ruby | set syntax highlight for ruby |
e | Go to end of the word |
b | Go to the beginning of the word |
0 | Beginning of the line |
$ | End of the line |
SHIFT + H | High - go to first line |
SHIFT + M | Middle - go to the middle of the file |
SHIFT + L | Low - go to the end of the file |
O | New line below and start editing |
SHIFT + O | New line above and start editing |
SHIFT + C | Remove the line and start editing from the beginning |
dw | Delete word |
2dw | Delete 2 words |
V | Visual mode. e and b select text. c change word, y copy, p paste |
U | Undo |
CTRL+R | Redo |
:set paste | Set mode for pasting |
SHIFT + D | Delete from cursor to end of line |
:1,10d | Delete from line 1 to 10 |
:1,$d | Delete all lines |
:%d | Delete all lines |
.vimrc
Command | Description |
---|---|
:set tabstop=4 | One tab=4 spaces |
:set expandtab | Insert space even if pressed tab |
:syntax on | Syntax highlight |
:set nowrap | Do not wrap lines |