Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic Vim Keys

Basic VIM Keys

Notes

  • a number in front of most movement and edit keys acts as a multiplier to that key
    • e.g. 30j moves the cursor down 30 lines and 3i tora types toratoratora
  • editing can be stacked with movement characters
    • e.g. dw will delete a word

Movement

h            moves the cursor one character to the left.
j            moves the cursor down one line.
k            moves the cursor up one line.
l            moves the cursor one character to the right.
0            moves the cursor to the beginning of the line.
$            moves the cursor to the end of the line.
w            move forward one word.
b            move backward one word.
e            move to the end of a word
G            move to the end of the file.
gg           move to the beginning of the file.
<num>G       moves to that line
`.           move to the last edit.

Editing

y            copy word  
yy           copy line
d            cut/delete word
dd           cut/delete line
p            put/paste
Ctl-v        visual block - select area using arrow keys
I            Insert text in visual block selected lines
A            Append text in visual block selected lines

Buffers & Windows

:e           edit file in new buffer
:ls          list buffers
:b<num>      goto buffer windows
:new         open a new(empty) buffer in a horizontal window
:split       open a new window
:vsplit      open a side by side window
:vnew        open a new buffer in a vertical window
:badd <file> open a file into a buffer   
:bdelete     delete buffer (by number or name)
Ctl-W q      quit a window

Misc

:set nu      Turn on line numbers
:set paste   Make pastes into vim "do the right thing"
:reg         Show registers - named registers a-z, unnamed 0-9
<reg>p       paste contents of named/numbered register
Ctl-A        command completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment