Vim for typing Test
c{motion}
(change) the text moved over by {motion}, that is, insert text to replace it
d
(delete) the highlighted text and put it into the clipboard.
y
(or yank, which is vim-ese for "copy") the highlighted text into the clipboard.
``
(register) go back to last cursor position before jump
`.
(register) go back to where cursor was during last edit
'}
(register) go to end of current paragraph
')
(register) go to end of current sentence
'{
(register) go to start of current paragraph
'(
(register) go to start of current sentence
<C-V>
Blockwise selection mode. Extremely powerful and available in very few other editors. You can select a rectangular block and any text inside that block will be highlighted.
v
Characterwise selection mode. This is the selection mode that most people are used to, so practice with it before trying the others.
yy
Copy the current line.
y{motion}
Copy the text moved over by {motion}.
O
Create a new line above the current one and insert text there.
o
Create a new line under the current one and insert text there.
C
Cut from the cursor to the end of the current line and leave the editor in insert mode.
D
Cut from the cursor to the end of the current line.
s
Cut the current character and leave the editor in insert mode.
x
Cut the current character. (This is sort of like a command-mode backspace.)
dd
Cut the current line
cc
Cut the current line and leave the editor in insert mode.
c
Cut the highlighted text into the clipboard. This is just like d, except it leaves the editor in insert mode.
c{motion}
Cut the text moved over by {motion} and leave the editor in insert mode.
d{motion}
Cut the text moved over by {motion} to the clipboard.
d{motion}
Delete the text moved over by {motion}
`.
Go to the line that you last edited.
>>
Indent the highlighted code. (See the earlier section about efficient text selection. If no text is selected, the current line is indented.)
I
Insert text at beginning of current line
A
Insert text at the end of the current line.
i
Insert text to the left of the current character.
a
Insert text to the right of the current character.
V
Linewise selection mode. Whole lines are always selected.
<C-B>
Move the cursor backward by a screenful of text
Fx
Move the cursor backward to the next occurance of the character x on the current line.
<C-F>
Move the cursor forward by a screenful of text
[num]G
Move the cursor line [num]
0
Move the cursor to the beginning of the current line
H
Move the cursor to the beginning of the file
gg
Move the cursor to the beginning of the file
G
Move the cursor to the end of the file
^
Move the cursor to the first character on the current line.
M
Move the cursor to the middle of the screen.
%
Putting the cursor on a brace, bracket, or parenthese and pressing __ will send the cursor to the matching brace, bracket, or parenthese.
*
Read the string under the cursor and go to the next place it appears.
@register
Replay the macro stored in the named register.
q[a]
Start macro recording into the named register [a]
/[text]
Starting from the cursor, find the next occurance of the string [text] and go to it.
Y
Yank the whole line, just like yy. (Yes, it's inconsistent! You can use y$ to do what you would expect Y to do.)
:reg
You can list all the currently defined registers and their contents
zM
close ALL folds of ALL levels in file
zc
close a fold that's been opened
zm
close all highest-level folds in file
zf
close an existing fold or make a fold from a highlight
zE
delete a fold (no undo!)
daw
delete a word
daB
delete an inner Block of code { }
das
delete the sentence we are in
q
end recording macro
:%s/[before]/[after]/g
find and replace [before] with [after] globally
:[relative line num], [concrete line number] fold
fold from [relative line num] lines away until [concrete line number]
zf[motion]
fold over [motion]
`[a]
go to bookmark [a]
gd
go to definition of function under cursor
K
go to man page for word under cursor
gD
goto first instance of the word under the cursor in the file
gj
goto next visual line, even if line wrapping
gk
goto previous visual line, even if line wrapping
:loadview
load the [saved] foldview if one exists with the file
m[a]
make a bookmark named [a] at current cursor position - a bookmark can be named any lowercase letter. you can't see it but it's there.
:mkview
make a foldview to save with the file
:make
make or build the current project with the makeprg in .vimrc
tx
move cursor forward to just BEFORE the next occurance of character x on the same line
fx
move cursor forward to next occurance of the character x on the current line (type ; to repeat)
<C-d>
move down a half screen
zj
move to next fold
zk
move to previous fold
<C-u>
move up a half screen
:[243]
navagate to line [243]
zR
open ALL folds of ALL levels in file
zo
open a fold
zr
open all highest-level folds in file
zO
open all nested folds on one line
gf
open the filename under the cursor
p
paste
]p
paste but automatically adjust indent level of pasted code
ga
print the ascii value of character under cursor
'a
put cursor at start of line [a]
/[text]n
re-execute a search for word [text]
#
read the string under the cursor and go to the previous place it appears
dat
remove from <tag> to </tag> in xml
.
repeat the last command you gave
?[text]
search for [text] backward in file
:marks
see a list of marks made
:cc
show you current error with make
xp
switch the current char and the next
ddp
switch the current line and the next
:cn
take you to next error with make
<<
un-indents selected or current line
[string] <C-N> or <C-P>
use keyword completion on previously typed [string]
c [lowercase letter] or p [lowercase letter]
use register [lowercase letter] for copy or paste operation