Skip to main content
๐Ÿš€ Claude Code Bootcamp โ€” May 30 5 hours from prompting to production. Build 10 real-world projects with AI-assisted development. Register Now
Vim Cheat Sheet 2026: Essential Commands for DevOps
DevOps

Vim Cheat Sheet 2026: Essential Commands for DevOps

Vim cheat sheet for DevOps engineers. Navigation, editing, search and replace, macros, registers, split windows. Copy-paste ready commands for daily operations.

LB
Luca Berton
ยท 1 min read

A quick reference for Vim โ€” the terminal text editor. Bookmark this page.

Modes

Normal mode  โ†’ default, press Esc to return
Insert mode  โ†’ press i, a, o, O to enter
Visual mode  โ†’ press v (char), V (line), Ctrl+v (block)
Command mode โ†’ press : from Normal mode
h j k l      โ†’ left, down, up, right
w / b        โ†’ next/previous word
0 / $        โ†’ start/end of line
gg / G       โ†’ start/end of file
:42          โ†’ go to line 42
Ctrl+d/u     โ†’ half page down/up
Ctrl+f/b     โ†’ full page down/up
%            โ†’ matching bracket

Editing

i            โ†’ insert before cursor
a            โ†’ insert after cursor
o / O        โ†’ new line below/above
x            โ†’ delete character
dd           โ†’ delete line
dw           โ†’ delete word
D            โ†’ delete to end of line
cc           โ†’ change (delete) entire line
cw           โ†’ change word
C            โ†’ change to end of line
r            โ†’ replace single character
u            โ†’ undo
Ctrl+r       โ†’ redo
.            โ†’ repeat last command

Copy and Paste

yy           โ†’ copy (yank) line
yw           โ†’ copy word
y$           โ†’ copy to end of line
p / P        โ†’ paste after/before cursor
dd then p    โ†’ cut and paste (move line)
"ay          โ†’ yank into register a
"ap          โ†’ paste from register a

Search and Replace

/pattern     โ†’ search forward
?pattern     โ†’ search backward
n / N        โ†’ next/previous match
*            โ†’ search word under cursor

:s/old/new/     โ†’ replace first on current line
:s/old/new/g    โ†’ replace all on current line
:%s/old/new/g   โ†’ replace all in file
:%s/old/new/gc  โ†’ replace all with confirmation

Visual Mode

v            โ†’ character selection
V            โ†’ line selection
Ctrl+v       โ†’ block (column) selection
d            โ†’ delete selection
y            โ†’ yank selection
>  / <       โ†’ indent/unindent selection

Windows and Tabs

:split file  โ†’ horizontal split
:vsplit file โ†’ vertical split
Ctrl+w w     โ†’ switch between splits
Ctrl+w h/j/k/l โ†’ navigate splits
:tabnew file โ†’ new tab
gt / gT      โ†’ next/previous tab
:q           โ†’ close current split/tab

File Operations

:w           โ†’ save
:w file.txt  โ†’ save as
:q           โ†’ quit
:q!          โ†’ quit without saving
:wq or ZZ    โ†’ save and quit
:e file.txt  โ†’ open file
:e!          โ†’ reload file (discard changes)

Advanced

ci"          โ†’ change inside quotes
ci(          โ†’ change inside parentheses
di{          โ†’ delete inside braces
da"          โ†’ delete around quotes (including quotes)
=G           โ†’ auto-indent entire file (from cursor)
gg=G         โ†’ auto-indent whole file
:set number  โ†’ show line numbers
:set paste   โ†’ paste mode (no auto-indent)
:noh         โ†’ clear search highlighting

Tips and Tricks

  • Use vimtutor to learn interactively (30 min tutorial)
  • Use .vimrc for persistent configuration
  • Combine counts with commands: 5dd deletes 5 lines
  • Use macros: qa to record, q to stop, @a to replay
  • Use :!command to run shell commands from Vim

Free 30-min AI & Cloud consultation

Book Now