0% found this document useful (0 votes)
616 views

Essential Vim Commands Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
616 views

Essential Vim Commands Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Vim Commands Cheat Sheet

Cursor Movement Ctrl f Move screen down by one page zr Decrease the foldlevel by one
h Move cursor left zz Center screen on cursor Decrease the foldlevel to zero—all
zR folds will be open
j Move cursor down zt Align top of screen with cursor
zb Align bottom of screen with cursor zd Delete the fold at the cursor
k Move cursor up
zE Delete all folds
l Move cursor right
[z Move to start of open fold
Move cursor to the start of the next Insert Mode (Insert Text)
w OR ¹W word ]z Move to end of open fold
i Enter insert mode
Move cursor to the start of the
b OR ¹B previous word I Insert at the beginning of the line

e OR ¹E Move forward to the end of a word a Insert (append) after the cursor
A Insert (append) at the end of the line Tabs
0 Move to the start of the line
#gt Move to tab number #
Move to the first non-blank Append (open) a new line below the
^ o current line
character of the line Move the current split window into
Ctrl w, t its own tab
$ Move to the end of the line Append (open) a new line above the
O current line Move current tab to the #th position
G Go to the last line of the document :tabmove # (indexed from 0)
Insert (append) at the end of the
nG OR :n Go to line number n ea word :tabnew
To the position before the latest Esc Exit insert mode filename/ :tabn Open a file in a new tab
'' jump, / where the last "m'" / "m`" filename
command was given.
Close the current tab and all its
:tabclose / :tabc windows
Move to next occurrence of
fx character x Change Case Close all tabs except the current
:tabonly / :tabo one
Move to one character before the ~ Toggle case (Case => cASE)
tx character x gt / :tabnext / :tabn Move to the next tab
gU Uppercase
} Move to next paragraph gT / :tabprev / :tabp Move to the previous tab
gu Lowercase
{ Move to previous paragraph
gUU Uppercase current line (also gUgU)
H Move to home (top) of screen
guu Lowercase current line (also gugu)
L Move to last line of screen Working With Multiple Files
M Move to middle of screen :e filename Edit a file in a new buffer
Visual Mode (Mark Text)
Move to 3rd instance of character x :ene Open a blank file for editing
3, f, x forward from cursor on current line. Start visual mode, mark lines, then
v do a command (like y-yank) :bnext / :bn Go to the next buffer
Move to 3rd instance of character x
3, F, x back from cursor on current line. V Start linewise visual mode :bprev / :bp Go to the previous buffer
vo Move to other end of marked area :bd Delete a buffer (close a file)
Ctrl v Start visual block mode Open a file in a new buffer and split
:sp filename window
Editing a File vO Move to other corner of block
vaw Mark a word Open a file in a new buffer and
r Replace a single character :vs filename vertically split window
dd Cut (delete) a line vab Mark a block with ()
Ctrl w, s Split window
yy Yank (copy) a line vaB Mark a block with {}
Ctrl w, w Switch windows
2yy Yank (copy) two lines vib Mark inner block with ()
Ctrl w, q Quit a window
J Join line below to the current one viB Mark inner block with {}
Ctrl w, v Split window vertically
cc OR S Change (replace) entire line Esc Exit visual mode
Ctrl w, h Move cursor to window left
Change (replace) to the end of the Ctrl w, l Move cursor to window right
cw word Visual Commands Ctrl w, k Move cursor to window above
Change (replace) to the end of the > Shift text right
c$ line Ctrl w, j Move cursor to window below
< Shift text left Ctrl w, r Rotate windows clockwise
s Delete character and substitute text
== Auto-indent current line
Ctrl w, T Move current window to a new tab
Transpose two letters (delete and
xp paste) << Shift current line left by shiftwidth
Close all windows except current
>> Shift current line right by shiftwidth :on window
u Undo
y Yank (copy) marked text Ctrl w, | Maximize width of active window
Ctrl r Redo
d Delete marked text Ctrl w, 1, | Minimize width of active window
. Repeat last command
~ Switch case Ctrl w, _ Maximize height of active window
Ctrl w, 1, _ Minimize height of active window
Search and Replace
Ctrl w, = Equalize the size of windows
* Search for word under cursor
/pattern Search for pattern Folding Commands
?pattern Search backward for pattern Create a fold from the cursor down Exiting a File
zf#j # lines :w Write (save) the file, but don't exit
n Repeat search in same direction
String creates a fold from the cursor :wq Write (save) and quit
N Repeat search in opposite direction zf/ to string
Write (save) current file if modified
Replace all instances of old with zj Move the cursor to the next fold :x OR ZZ and quit
:%s/old/new/g new
zk Move the cursor to the previous fold Quit (fails if there are unsaved
Replace all instances of old with :q changes)
:%s/old/new/gc new, with confirmations za Toggle a fold under cursor
zo Open a fold at the cursor :q! Quit and discard unsaved changes
zO Open all folds at the cursor :qa Quit all buffers and windows
Screen Movement
zc Close a fold under cursor ZQ Quit without checking for changes
Ctrl u Move screen up by half page
Ctrl b Move screen up by one page zm Increase the foldlevel by one

Ctrl d Move screen down by half page zM Close all open folds ¹Word can contain punctuation.

Copyright © 2019 MakeUseOf. For more cheat sheets, head over to www.makeuseof.com

You might also like