VIM - How-to

From Linux - Help
Jump to navigation Jump to search
Debian Logo

PAGE WORK IN PROGRESS

Simple VIM Reference:

To get into insertion mode, type i (abbreviation for insert). To get into command mode, press the Esc key.

Navigation:

 Go up                          k
 Go down                        j
 Go left                        h
 Go right                       l
 Go right a word                w
 Go left a word                 b
 Go to beginning of file        gg
 Go to end of file              G
 Go 22 lines down               22j
 Go to end of line              $
 Go to beginning of 
 non-whitespace part of line    ^
 Go right 5 words               5w


Visual mode:

Copy & Paste: Press v. (To enter visual mode so you can highlight stuff), Use the arrow keys (or h,j,k,l,w,b,$) to highlight.

Press y to yank, p to paste. (shift-p to open up a line above and paste)

 Copy a word                         yw
 Copy a line                         yy
 Copy from cursor to end of line     y$

Deleting: Press v. (To enter visual mode so you can highlight stuff)

Use the arrow keys (or h,j,k,l,w,b,$) keys to highlight and press d

 Delete character                   x
 Delete word                        dw
 Delete word and insert text        cw
 Delete line                        dd
 Delete to end of line              d$