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

Basic Vim Cheat Sheet

by Zoltan via cheatography.com/35548/cs/11255/

Modes Yank (Copy), Delete (Cut) and Put (Paste) Moving Around

ESC Command mode, toggles modes when yy Yank the current line h or Move LEFT one character
in insert or visual mode :y Yank the current line left

i insert mode j or Move DOWN one line


y Yank the highli​ghted text
v Visual mode, start highli​ghting down
:d or Delete current line
characters k or Move UP one line
dd
up
V Visual mode, start highli​ghting lines
D Delete to the end of the line
l or Move RIGHT one line
d Delete the highli​ghted text
Shell Command right
dw Delete word
H Move to the FIRST line of the screen
:shell Opens command prompt
dl Delete character at cursor position
M Move to the MIDDLE line of the
exit Exits command prompt
p Put text after cursor position, put lines screen
below current line
Files L Move to the LAST line of the screen
P Put text before cursor position, put lines
b Move to the BEGINNING of the word
:e Open a new file above current line
filename B Move to the BEGINNING of a blank
x Delete current character
delimited word
:w Save changes to a file
filename e Move to the END of the word
Windows
:q Exit Vim. If there is unsaved files, E Move to the END of black delimited
:split or Splits the current window word
Vim will not exit
:sp horizo​ntally
:q! Exit Vim wihout saving changes w Move to the NEXT word
:vsplit or Split the current window vertically
:x or zz Exits Vim and saves changes to the W Move to the NEXT blank delimited
:vs
file if changes were made word
:split file Opens the file in a second window
:n Jump to line n (jump to line 42->:42)
:n split Opens a new window n lines high
Undo and Redo
file To move up 9 lines type: 9k
u Undo last action
:new Opens a new window horizo​ntally
U Undo all the latest changes that were Buffers
:vnew Opens a new window Vertically
made to the line
:buffers find list of buffers
:res n Resizes window to n line size, if n
Ctrl+r Redo
is not provided window is resized to :b number Select buffer number
max size :sb number Splits the window and starts
Open up new lines
CTRL- Switches cursor between windows editing the buffer
o Open new line BELOW the cursor ww :vertical Splits the window vertically
O Open new line ABOVE the cursor CTRL-w Switches cursor between windows sbuffer and edits the buffer
<motion in motion key direction number

Tabs key> :bnext or :bn Go to the next buffer


CTRL- Splits a window and starts editing :bdelete Deletes a buffer without
:tabnew Opens a new tab
wn a new file saving
gt go to next tab
CTRL-w Rotate windows positions
gT Go to previous tab --Buffer Flags--
r - Inactive buffer
:tabmove n Move tab to position n
CTRL-w Close window h Hidden buffer
:tabc Close tab q or :q % Current buffer
# Alternate buffer
+ File has been modified

By Zoltan Published 24th March, 2017. Sponsored by Readability-Score.com


cheatography.com/zoltan/ Last updated 25th March, 2017. Measure your website readability!
Page 1 of 1. https://readability-score.com

You might also like