This is an old revision of the document!


VIM Commands

* you can start the VIM tutor by typing 'vimtutor' at a command prompt

h, j, k, l move left, down, up, right
$ or END jump to the end of the current line
<html>&#094;</html> or HOME jump to the beginning of the current line
Shift-G go to end of file
<number> Shift-G go to line <number> of file
Ctrl-e scroll window downwards by line
Ctrl-y scroll window upwards by line
Ctrl-f scroll window page forward (down)
Ctrl-b scroll window page back (up)
Ctrl-g show line/percentage location in file and file status
:q quit
:q! quit without saving changes
:w save changes
:wq save changes and quit
:! <command> execute an external command, such as dir, ls, etc…
:r <filename> insert the contents of a file
/ <searchterm> begin search for <searchterm>
n continue searching the file for <searchterm>
Shift-N search in the opposite direction
? <searchterm> begin backwards search for <searchterm>
% find matching ), ], or }
:s/old/new search and replace the first occurance of 'old' with 'new' in the current line
:s/old/new/g search and replace all occurances of 'old' with 'new' in the current line
:#,#s/old/new/g search and replace all occurances of 'old' with 'new' between the two line numbers (#,#)
:%s/old/new/g search and replace all occurances of 'old' with 'new' in the whole file
:%s/old/new/gc search and replace all occurances of 'old' with 'new' in the whole file,
asking for confirmation each time
p put (paste below)
Shift-P put (paste above)
v block select (characterwise) mode
V block select (linewise) mode
<number>yy yank <number> of lines into register (copy)
y (after block select) yank (copy)
d (after block select) delete (cut)
i insert
r replace (temporary mode)
a append
cw change word (delete remaining portion of the word, and begin editing)
c(same options as d) change line, change word etc…
dd delete line
de delete word (no space)
dw delete word
d$ delete to end of line
d<html>&#094</html> delete to beginning of line
u undo
U undo all for line
Ctrl-r undo an undo (reverse direction)
> indent
< outdent
  • docs/vim/commands.1186121184.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)