2026-07-16

VIM

VIM

First of a series of cheatsheets. The commands I actually reach for in Vim.

Commands

:helpmanual
vimtutorvim tutorial
:open <filename>open file
:Explorenavigate to or open other files
iinsert mode
< | >indent or unindent line one level
.repeat last command
Rreplace mode
b / wmove to previous or next word
:save <name>save file as
:edit <filename>edit file
:vsplit | vs | C-w vvertical split
:hsplit | sp | C-w shorizontal split
C-w hjklchange window
C-w HJKLmove window to
C-w +- <>resize window
C-w C-rrotate windows
:lsshow buffers
:b <number>change current buffer to
:bn | :bpmove to next or previous buffer
:close <current or buffer-number>close buffer
:set mouse=aenable mouse functionality
:terminalopen terminal
:set numbershow line numbers
:54move to line 54
ggVGselect all lines
uundo
Ctrl-rredo
tabnew <name>new tab
gtswitch between tabs
shift+vselect line
ctrl+vblock select
yyank selected block or lines
ppaste lines that you yanked before
d | xdelete/cut selected block
ocreate new line below and move to insert mode
Ocreate new line above and move to insert mode
:syntax on|offenable or disable syntax highlighter
mks | mks! <name.vim>make session file
vim -S | :so session.vimopen session file
:scrollbindscroll same in all panes
:set noscrollbind | :tabdo windo set noscrollbinddisable scrollbind
ctrl+-zoom out
ctrl+shift++zoom in
:colorschema retroboxset colorscheme
:set filetype=<extension|html>set filetype
:X | -x <filename>encrypt file
set key=disable encryption
0jump to start of line
$jump to end of line
gggo to first line
Ggo to last line
:w !sudo tee %save readonly file
~/.vimrcmake your configuration persistent by writing it here
:cd %:p:hchange vim dir to current dir

Vimdiff

shift+v — select lines that you want to change, then type :diffget or :diffput to make changes. Run :diffupdate to refresh the page.

Websites

Plugins

← Back to blog