Commonly used vim commands
For basic vim commands, run vimtutor
in your terminal. It is recommended to go over this before you read further. Below are more advanced commands
Commands
Shortcuts
toggle NerdTree
\
toggle NerdTree and jump to the current file
`
quickly search for a file
<ctrl>p
quickly search for a file that was opened recently
<ctrl>pf
split the view horizontally
:sp
split the view vertically
:vs
comment / uncomment
,c<space>
indent
>
unindent
<
select same words
<ctrl>n
select a block, excluding the parent wrapper
vii
select a block, including the the parent wrapper
vai
go to the next character 'x' in the same line
fx
go to the previous character 'x'in the same line
Fx
capitalize/uncapitalize a character or a block
~
go to the right pane
<ctrl>l
go to the left pane
<ctrl>h
go to the upper pane
<ctrl>k
go to the lower pane
<ctrl>j
search for the word under cursor
,vv
replace the word under cursor
,vr
search in working directory
Grep <string/regex>
replace in working directory
Replace <string/regex>
go to the corresponding opening / closing braces
%
find the word under the cursor in the current file
*
show/hide highligts after searching
<space>
fold all code blocks to the root level
zM
fold all code blocks for 1 level
zm
unfold all code blocks for 1 level
zr
unfold all code blocks
zR
unfold the code block under cursor for only 1 level
zo
unfold the code block under cursor for all levels
zO
quickly jump to a string by first 2 characters of the string
s<first 2 chars>
go back to the recent file
^
Commands
Shorcuts
go to the next change in the file
]c
go to the previous change in the file
[c
git status
:Gstatus
git commit
:Gcommit
git push
:Gpush
git blame
:Gblame
other git commands
:Git <command>
Commands
Shorcuts
show available commands
?
go to the next GIT change in the tree
]c
go to the previous GIT change in the tree
[c