Vimtutor
The Vimtutor is Vim’s interactive tutorial. It’s included in most (all?) Vim installations. You can find more information about it here.
lesson 1
-
h j k lmovement -
vim <filenameopen file -
ESCnormal mode -
:q!exit without saving -
xdelete char under cursor -
iinsert text -
Ato append text at end of line -
:wqsave and exit
lesson 2
-
dwdelete rest of word -
d$delete until end of line - motions:
wstart of next word,eend of current word,$end of line - count: number before motion to repeat
-
0to start of line -
2dwandd2wdo the same thing, operator-[number]-motion -
dddelete line -
uundo change -
Uundo changes whole line -
ctrl+rredo
lesson 3
-
pput deleted after cursor -
rreplace character at cursor -
c[number]<motion>change until motion
lesson 4
-
ctrl+gfile location and status -
Gmove to bottom of file -
ggmove to start of file -
<lineno>Ggo to line number -
/search forward,?search backward,nmatch forward,Nmatch backward -
ctrl+ojump back in jumplist,ctrl+ijump forward in jumplist -
%matching parentheses)]} -
:s/old/newsingle find-and-replace -
:s/old/new/gline-global find-and-replace -
:#,#s/old/new/grange of lines -
:%s/old/new/gwhole file -
:%s/old/new/gcwhole file, prompt
lesson 5
-
:!<command>execute external command -
:w <filename>save file -
vvisual mode (selection) -
:r <thing>retrieve and insert, e.g.:r <filename>or:r !ls
lesson 6
-
oopen line below cursor -
Oopen line above cursor -
aappend text after cursor -
Rreplace mode -
yyank for copy (yank is operator so movements) -
pput for paste -
:set icignore case,:set noic -
:set hls ishlsearch (highlight matches) and incsearch (show partial matches) options -
:nohlsearchdisable highlighting of matches -
\cignore case for single search, e.g./ignore\c -
icignorecase,isincsearch,hlshlsearch
lesson 7
-
F1,:help -
ctrl+w ctrl+wjump windows -
:qclose window :help <something>-
~/.vimrcstartup script -
ctrl+dtabcommand completion