Skip to content

Instantly share code, notes, and snippets.

@athieriot
Last active December 29, 2015 05:17
Show Gist options
  • Save athieriot/0ae7aeedf01b5bfbef0d to your computer and use it in GitHub Desktop.
Save athieriot/0ae7aeedf01b5bfbef0d to your computer and use it in GitHub Desktop.
Vim
--------------------------------
BASICS
--------------------------------
i / insert
u / Undo
<ctrl-r> / Redo
:q / quit
:q! / force
:wq / save and quit
<ESC> Escape insert mode
--------------------------------
NAVIGATE
--------------------------------
hjkl or arrows / moving around
w / next word
b / previous word
} / next paragraph
{ / previous
:3 / move to line 3
gg / beginning of file
G / end of file
0 / beginning of line
$ / end of line
% / corresponding parenthesis
--------------------------------
EDIT
--------------------------------
i / Insert before
a / Insert after
I / Insert beginning line
A / Insert end line
o / Insert bellow
O / Insert above
r / replace
cw / change word
x / cut character
dd / cut line
dw / cut word
y / copy (yank) character
yy / copy line
yw / copy word
p / paste
<ctrl-a> / Increase a number
<ctrl-x> / Decrease a number
. / Repeat last change
--------------------------------
SEARCH
--------------------------------
/<text> / Search a text
/ / Search previous text
# / Search the selected word
n / next find
N / previous find
:noh / hide highlight
--------------------------------
VISUAL
--------------------------------
v select characters
<shift-v> select line
<ctrl-v> select columns
y / yank selection
:s/// sed on selection
"+y / yank to register +
"+p / paste from register +
:registers
--------------------------------
FILES
--------------------------------
vim one.txt two.txt
:edit pom.xml / open a file (Autocomplete)
:new / create a file
:ls / list open files (:buffers)
:n / To next file
:p / To previous file
:b4 / To file 4
:b <tab> / autocomplete files
--------------------------------
WINDOWS
--------------------------------
:help
:split
:vsplit
:tabnew
--------------------------------
MARKS
--------------------------------
--------------------------------
EXTRA
--------------------------------
3y / copy 3 lines
c} / Change paragraph
:set list
:set nolist
:set number
:set nonumber
:! / Execute a command without exiting vim
:w !sudo tee % > /dev/null / Write as root
Record
--------------------------------
CONFIGURATION
--------------------------------
~/.vimrc
= / Format
cmap w!! / make new shortcuts
--------------------------------
PLUGINS
--------------------------------
Autocompletion
Surround
<Ctrl-n> / NerdTree
<Ctrl-p> / Search files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment