Skip to content

Instantly share code, notes, and snippets.

@alissapajer
Last active October 25, 2015 08:19
Show Gist options
  • Save alissapajer/63f47f869b9cbd2054e2 to your computer and use it in GitHub Desktop.
Save alissapajer/63f47f869b9cbd2054e2 to your computer and use it in GitHub Desktop.
vim shortcuts
MOVEMENT
j k h l - up down left right (by character)
b w - left right (by word)
gg G - bof eof
0 $ - bol eol
^ - bot
shift-% - jump to matching Klammer
ctrl-e - up one line
ctrl-y - down one line
ctrl-u - up half a page
ctrl-d - down half a page
COMMAND (NORMAL) MODE
ESC - enter normal mode
r - replace character
yy dd - yank delete line
x - delete character
db dw - delete bow eow
yb yw - yank bow eow
D - delete to eol (same as d$)
P p - put before after
J - join previous line to current line
# * - previous next word search
N n - previous next search result
. - repeat last command
u - undo
ctrl-r - redo
FROM NORMAL TO INSERT
a i - insert before after cursor
A I - insert at bol eol
o O - insert new line below above
C - delete to eol
s - delete character
S - delete line (same as cc)
cb cw - delete to bow eow
c$ - delete to eol
VISUAL MODE
v - visual mode
LINEWISE VISUAL MODE
V - linewise visual mode
BLOCK VISUAL MODE
ctrl-v - block visual mode
I A ESC - vertical edit after before cursor
COMMAND LINE
/foo - search for text (`n` and `N` to navigate)
:s/foo/bar/g - search and replace (all instances in current line)
:%s/foo/bar/g - search and replace (all instances)
:%s/foo/bar/gc - search and replace (all instances, with confirmation)
:%s/\(foo\), \(bar\)/\2, \1/g - store regex variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment