Vim Cheatsheet

ADVERTISEMENT

VIM Cheatsheet
.vimrc for this cheatsheet available on Github @ brennanmeadowcroft/dotfiles
Derived From Plugin
Derived From Preferences
Movement
Search/Replace
Global
h
Move cursor LEFT
:help <keyword>
Open help for <keyword>
Within Buffer
j
Move cursor DOWN
:o <file>
Open <file>
k
Move cursor UP
/<keyword>
Search buffer for <keyword>
:saveas <file>
Save current file as
l
Move cursor RIGHT
n
Move DOWN to next instance
:close
Close current pane
H
Move cursor to TOP of screen
N
Move UP to next instance
:help <keyword>
Opens help for <keyword>
M
Move cursor to MIDDLE of screen
*
Search buffer for word under
<n><cmd>
Runs <cmd> <n> number of times
cursor
L
Move cursor to BOTTOM of
<Esc>
Returns to normal mode
screen
Within Working Directory
w
Jump forward to START of
Vim <Leader>: ,
WORD
<Leader>+a
Search (ack) INSIDE files in
working directory
e
Jump forward to END of WORD
v
Open file from search (ack) in
^
Jump to first non-blank character
Exiting
VERTICAL split
of line
$
Jump to END of LINE
h
Open file from search (ack) in
:w
Write (save) current buffer without
HORIZONTAL split
O
Jump to START of LINE
exiting
Ctrl+b
Page Up
:Q
Quit all buffers (fails if
Replace
unsaved changes)
Ctrl+f
Page Down
<n>G
Go to line <n>
:%s/<old>/<new>/g
Replace all <old> with <new> in
:q
Quit current buffer (fails if
file
gg
Go to FIRST line of file
unsaved changes)
G
Go to LAST line of file
:%s/<old>/<new>/gc
Replace all <old> with <new> in
:q!
Force quit current buffer
file WITH CONFIRMATIONS
}
Jump to next paragraph/function/
:wq / :x
Write changes and quit
block
{
Jump to previous paragraph/
function/block
Keyword Completion
Visual Mode
Ctrl+y
Scroll UP without moving cursor
Ctrl+n
Open auto-complete menu
Ctrl+e
Scroll DOWN without moving
cursor
Marking Text
<Tab>
Open auto-complete menu
Ctrl+n
Move DOWN in autocomplete
v
Start visual mode
menu
V
Start linewise visual mode
Editing
Ctrl+p
Move UP in autocomplete menu
Ctrl+v
Start visual block mode
J
Join line below to current one
aw
Mark a WORD
cc
Change (replace) entire line
ab
Mark AROUND block/function of
cw
Change (replace) to end of word
()
Buffers
aB
Mark AROUND block/function of
c$
Change (replace) to end of line
{}
ib
Mark INSIDE block/function of ()
:ls
List all buffers
s
Delete character and substitute
iB
Mark INSIDE block/function of {}
text
:bd
Close current buffer
:bd<n>
Close <n> buffer
xp
Transpose two letters
Visual Commands
:bn
Navigate to next buffer
u
Undo
<
Shift marked lines left
:bp
Navigate to previous buffer
Ctrl+r
Redo
>
Shift marked lines right
Ctrl+c
Close the current buffer
.
Repeat last action
y
Yank (copy) marked lines
Ctrl+h
Navigate to previous buffer
ci<char>
Change INSIDE <char>
d
Delete (cut) marked lines
Ctrl+l
Description
ca<char>
Change AROUND (including)
~
Change case of marked lines
<char>
Cut/Paste
Inserting Text
Code Folding
yy
Yank (copy) a line
i
Insert BEFORE cursor
yw
Yank (copy) a word
zc
Close a fold
I
Insert at beginning of line
y$
Yank (copy) to end of line
zo
Open a fold
a
Insert AFTER cursor
p
Paste BEFORE cursor
zA
Toggle all folds in buffer
A
Insert at END of LINE
P
Paste AFTER cursor
za
Toggle single fold
o
Add new line BELOW current line
dd
Delete (cut) a line
zM
Close ALL folds in buffer
O
Add new line ABOVE current line
dw
Delete (cut) a word
ea
Insert at END of WORD
d$
Delete (cut) to end of line
x
Delete (cut) single character
<Leader>+v
Enter Paste Mode

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2