Skip to content

Instantly share code, notes, and snippets.

@linuxfemale
Created November 18, 2019 15:13
Show Gist options
  • Save linuxfemale/eb36a67ec84e3b9df6e973c6d34d4d9a to your computer and use it in GitHub Desktop.
Save linuxfemale/eb36a67ec84e3b9df6e973c6d34d4d9a to your computer and use it in GitHub Desktop.
vi shortcuts
COMMAND MODE
i = Enter insert mode
o = Insert after current line (enter insert mode)
O = Insert before current line (enter insert mode)
a = Append after current character (enter insert mode)
A = Append at end of line (enter inset mode)
u = undo
dd = Remove current line (add <int> before for multiple)
dk = Remove previous line (add <int> before for multiple)
di<character> = Remove characters between given character
dw = Remove current word
cw = Remove current word and enter insert mode
ci<character> = Remove characters between given character, enter insert mode
d$ = Remove rest of line
yy = Copy current line
p = Paste after current line
<< = Shift line left
>> = Shift line right
dG = Remove rest of file
D = Remove rest of line
xp = Transpose current and next character
~ = convert case if character
+ = Start of next line
Ctrl+f = Forward one page
Ctrl+b = Back one page
<int>G = Goto specified line in file
H = Goto first line in window
L = Goto last line in window
/<term> = search forward for term (n to repeat forward, N to repeat back)
?<term> = search backwards for term (n to repeat back, N to repeat forward)
(add \c to make case insensitive)
:<int> = Goto specified line in file
:$ = goto end of file
:!<cmd> = Run shell command
:%s/<search>/<replace>/g
- Replace all occurances of <search> with <replace>
ZZ = Save and quit
INSERT MODE
Esc = Leave insert mode / enter command mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment