My (Neo)Vim Cheat Sheet

I love Vim because I can do everything with the keyboard. The downside, is that you have to do everything with the keyboard.

In case you didn’t get the pun, the real problem is that you have to memorize a bunch of commands and key combinations to to do things like delete a line in the current text or how to format the current buffer.

To aid myself on memorizing this commands I created this cheat sheet that works with my configuration.

If you want something more complete, graphical and generic, you can visit the Graphical vi-vim Cheat Sheet and Tutorial site.

One thing tough. I try to use the default key-maps as much as I can, so this cheat sheet might still be useful to you in case you want to create you own.


Movements and insert

This commands are for normal mode:

wBeginning of the next word
bBeginning of the previews word
eEnd of the next word
oTo get to the other end of the selection
$End of line
f<char>Go to forward to the next character. Pe. fx
{Go to previous paragraph (empty line)
}Go to next paragraph (empty line)
AAdd text at the end of the line
IAdd text at the beginning of the line
zzPlace the current line in the middle of the editor window
z<enter>Place the current line at the top of the editor window

Advanced movement commands

All this commands are for normal mode:

ggGo to beginning of file
GGo to end of file
<C-f>Page Down (Page Forward)
<C-b>Page Up (Page Backward)
gdGo to definition of word or function in current file
gfTo to definition in other file
<number>GGo to line <number>. P.e. 16G
<C-o>Previous position or previous buffer (useful when using gd or gf)
<C-i>Next position or next buffer

Advanced save

This commands are for normal mode:

<number1>,<number2>w file-name.txtSaves lines to a new file. P.e. 12,43w
:r <file-name.txt>Inserts contents of file-name.txt in current position

Delete Undo/Redo

This commands are for normal mode:

xCut (Works in visual mode too)
sCut (Substitute) char and place in insert mode
deDelete to end of word
d0Delete to the beginning of the line
dbDelete back
df<char>Delete until the next <char>. P.e dfx
:.,$dDelete until the end of the buffer
UUndo on the whole line


Most commands, when preceded by a number, are executed multiple times:

6dwDelete next 6 words
6ddDelete next 6 lines
.Redo last change action
;Redo last character find f{char}


y<movement>Copy (Yank). <movement> can be h, j, l, k, w, e, $, 0
pPaste it after the cursor
ddDelete line
OPaste over the current line
PPaste under the current line


It’s like a clipboard history

:reg, :reg [char]List registers. Show contents of one register
"<number>pPaste contents of register. P.e. "2p Pastes register 2
<C-r><char>Paste the contents of register in insert mode
""The register used when Copy (y), Cut (x) or Substitute (s)
"0-"9Last yanked elements being "0 the newest ( "0p is the same as p)
"%Current file path starting from the project root


rReplace current character
ROverwrite content (replace) until you escape
ciwChange Inside word no matter the position
cipChange Inside paragraph (between empty lines) no matter the position
ci)Change (inside) the contents until the next )


ziFold enable
zf2jFold the next 2 lines (depends of the fold type)
:20,40 foFold from line 20 to 40
zfa}Fold until the next }
zo zOOpen current fold. Open recursively
zc zCClose current fold. Close recursively
za zAToggle current fold. Toggle recursively
zm zMReduce fold level by one. Close all folds
zr zRIncrease fold level by one. Increase recursively
?Search backwards
*Search for the word under the cursor
nNext result
NPrevious result

Search & Replace

:s/original/new/gSearch and replace in the complete line
:%s/original/new/gcSearch in all document asking if do the change (c)


vStart the visual (Use jkhl to move the selection)
v$Select until the end of line
vipSelect current paragraph (content between empty lines)
VVisual the complete line (Use jk to move the selection)


:sp, :vsSplit and Vertical split
:onlyFocus on a splt
giOpen in split in NERDTree

QuickFix and Location List

:copenOpen error list
:ccloseClose error list
:cnextGo to next error

Debug utilities

Ctrl-gShow file status
:verbose imap <tab>Find if the <tab> key is defined
:verbose imap <C-p>Find if the <ctrl>p key is defined
:lopen, :lcloseOpen/closes the location list. Used by plugins like ALE to show a list of errors
:copen, :closeOpen/Closes/Focuses the list of errors

Native Autocomplete

<C-x><C-p>Autocomplete with an already present word


:mks <path>Saves the current session to a path. Better if it’s a hidden dir

Markers and Macros

m<character>Creates a marker with the name <character
'<character>Jumps to marker. (Use backtick to include column )


Spell needs to have set spell option active on .vimrc and optionally use set spelllang=en_us. I use es_co for Spanish Colombia.

z=Search for alternatives of the current word
zgAdd current word to dictionary
zwRemove current word from dictionary
]sJump to next spell error
[sJump to previous spell error


NERDTree Commands

This are particular to my configuration

<C-k><C-k>Toggle NERDTree (open if closed, close if open)
<C-k><C-f>Toggle NERDTree and select the current file

This commands are to be executed while inside the NERDTree sidebar:

sOpen on left
vsOpen on top
tOpen on new tab

NERD Commenter

This are the default key-maps

<leader>c<space>Toggle comments
<leader>ciToggles the comment state of the selected line(s) individually.
<leader>csToggle sexy Comments out the selected lines with a pretty block formatted layout.

FZF Commands

Its really helpful to use :help fzf-vim-comands to browse the documentation

:BCommitsCommits for the current buffer (Requires Fugitive)
:CommandsSearchable list of ALL commands
:GFilesIgnores files in .gitignore
:HistoryOpens up the list of last edited files
:Rg!Like grep for all the project files but faster
:SnippetsUtilSnips snippets
:TagsTags in the project
<C-k><C-u>Executes :Buffers
<C-6>Loops through the 2 most recent buffers


:GitGutterToggleShow/Hide file changes
[cShow next block of changes
]cShow previous block of changes
<Leader>huRemove hunk
:GitGutterFoldToggle fold of the file changes


This commands are to be executed on the :Gstatus window

g?Show help
=Toggle small diff of the file under the cursor
-Toggle stage/unstage file under cursor
dvDiff split vertically
<leader>gsToggle Status (my .vimrc)

CoC commands

This commands assume you used the example configuration suggested by the CoC GitHub page

:FormatCode beautify
:FoldFold functions
:OROrganize Imports
:CocConfigOpen the configuration file
:CocInstall <plugin name>Install a new CoC plugin


A complete tutorial can be viewed here

ys<motion><char>You surround. Pe, ysiw', ysa2w"
cs<char><char>Change surrounding. Pe. cs'" Change surrounding ' with ". Or cstt change tag with another tag
ds<char>Delete surrounding. Pe. ds' Remove surrounding quote. dst will delete a tag
dWDelete word including it’s surrounding space
yss<char>The line. Pe yss" Surround the line with "
yssf, ysiwfYou surround with a function (It will prompt you for the function name). iw its inside a word
ysst, ysiwtYou surround with an html tag. (it will prompt you for the tag)
ysas"You surround a Sentence
ySSurround a motion and adds a line afterwards. Pe. ySi2w(
ySSSurround the complete line and add a line afterwrds. Pe ySS(

In visual mode

SSurround the selected words
gSSuppress auto indent


_ (space)s
< (html)t