Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Crypticfrog's Vim Commands Cheat Sheet

Moving Inserting Copying Marks and Jumps

h move cursor left i switch to insert mode before the cursor yy copy an entire line m[a-z] marking text using character mode
[from a to z]
j move cursor down I insert text at the beggining of the line #yy copy the specified number of lines
m[a-z] mark lines using line mode [from a to z]
k move cursor up a switch to insert mode after the cursor yaw copy a word with its trailing whitespace
`a jump to position marked a
l move cursor right A insert text at the end of the line yiw copy a word without its trailing
white-space `y`a yank text to position marked a
#h [j/k/l] move in a specified direction multiple o open a new line below the current one
times y$ copy everything right of the cursor `. jump to last change in file
O open a new line above the current one
b/B move to the start of a word / token y^ copy everything left of the cursor `" jump to last edit in file
ea insert text at the end of the word
w/W move to the start of the next word / ytx copy everything between the cursor `0 jump to position where Vim was last
token Esc exit insert mode and a specified character (x) existed

e/E move to the end of a word / token yfx copy everything between the cursor `` jump to last jump
and a specified character (including that
Editing character) :marks list all marks
0 (zero) jump to the beginning of line
r replace a single character (+ return to :jumps list all jumps
$ jump to the end of line command mode)
Cutting :changes list all changes
^ jump to the first (non-blank) character cc replace entire line (+ move into insert
of line mode) Ctrl+i move to next instance in jump list
dd cut the entire line

#G / #gg / :# move to a specified line number C / c$ replace from cursor to the end of line Ctrl+o move to previous instance in jump list
#dd cut a specified number of lines
(replace # with the line number)
cw replace from cursor to the end of the g, move to next instance in change list
d$ everything right of the cursor
word
g; move to previous instance in change list
Moving by Screens s delete a character (+ move into insert
mode)
Pasting
Ctrl+b move back one full screen J merge with line below, separated with a Macros
single space p paste text after the cursor
Ctrl+f move forward one full screen qa record macro a
gJ merge with line below, with no space P paste text before the cursor
Ctrl+d move forward 1/2 a screen between q stop recording macro

Ctrl+u move back 1/2 a screen . repeat last command @a run macro a

Ctrl+e move screen down one line (without Marking @@ run last macro again
moving cursor)
Undoing/Redoing v marking text using character mode
Ctrl+y move screen up one line (without
moving cursor) u / :u / :undo undo changes made in last entry V mark lines using line mode
Multiple Files
Ctrl+o move backward through the jump #u undo multiple changes Ctrl+v mark text using block mode
history
:e file_name open a file in a new buffer
U undo latest changes in line o move from one end of the marked text
Ctrl+i move forward through the jump to the other
:bn move to next buffer
history Ctrl+r redo the last undone entry
aw mark a word
:bp go back to previous buffer
H move to the top of the screen #Ctrl+r redo multiple changes
ab mark a block with ()
:bd close buffer
M move to the middle of the screen :undolist list undo branches
aB mark a block with {}
:b# move to the specified buffer (by
L move to the bottom of the screen
number)
at mark a block with <>
Deleting
:b file_name move to the specified buffer (by name)
ib mark inner block ()
Searching dd / D delete a single line :ls list all buffers
iB mark inner block {}
dw delete a single word :sp file_name open a file in a new buffer and split
* jump to the next instance of a word it mark inner block <>
viewpoint horizontally
#dd / d#d delete multiple lines
# jump to the previous instance of a :vs file_name open a file in a new buffer and split
word :#,#d delete a range of lines viewpoint vertically

/pattern search forward for the specified :%d delete all lines
Visual Commands
:vert ba edit all files as vertical viewports
pattern
:.,$d delete from current line to the end of y yank (copy) the marked text :tab ba edit all buffers as tabs
?pattern search backward for the specified file
pattern d delete (cut) the marked text gt move to next tab
dgg delete from current line to the
n repeat the search in the same beggining of file p paste the text after the cursor gT move to previous tab
direction
:g /pattern/d delete lines containing a specified u change the marked text to lowercase Ctrl+ws split viewport horizontally
N repeat the search in the opposite pattern
direction U change the marked text to uppercase Ctrl+wv split viewport vertically
:g!/pattern/d delete lines that don't contain a
specified pattern Ctrl+ww switch viewports

:g/^$/d delete all blank lines Color Schemes Ctrl+wq quit a viewport

:colorscheme [colorscheme_name] change to Ctrl+wx exchange current viewport with next


specified scheme one

:colorscheme [space]+Ctrl+d list available Vim Ctrl+= make all viewports equal height and
color scheme width

You might also like