Pro Tips & Tricks

Unlock Hidden Powers.

Vim is full of secrets. Discover the commands that will make you look like a wizard in front of your colleagues.

/
Productivity
wizard

Save as Sudo

Forgot to open the file with sudo? No problem. Use this command to save the file with root privileges without closing it.

:w !sudo tee %
Config
basic

Relative Line Numbers

Toggle relative line numbers to make vertical jumps (like 10j or 5k) much easier to calculate.

:set relativenumber
Editing
pro

Change Inside Container

Instantly clear and enter insert mode inside quotes, brackets, or tags. The ultimate editing shortcut.

ci"
Search
pro

Global Search & Replace

Replace all occurrences of "foo" with "bar" in the entire file, asking for confirmation for each.

:%s/foo/bar/gc
Editing
pro

Paste from Register 0

Paste the text you just yanked, not what you just deleted. Register 0 always holds the last yank.

"0p
Navigation
basic

Jump to Last Edit

Teleport your cursor back to the exact location where you last made a change.

g;
Editing
pro

Visual Block Mode

Edit multiple lines at once. Perfect for commenting out blocks or adding prefixes.

Ctrl + v
Productivity
basic

Built-in File Explorer

Open the built-in file explorer (Netrw) to browse files in the current directory.

:Ex
Productivity
wizard

Record a Macro

Start recording keystrokes into register "a". Press q again to stop. Replay with @a.

qa