All tags
Start here · vimAdvanced tmux, a config that grows with you, formats, layouts and more9 steps · 52 min read · People who know the tmux basicsStart the guide vim
Narrow down
Guides1
Other tips42
- Tip
:%s/<Ctrl-r><Ctrl-w>/newname/gCtrl-r Ctrl-w in the Vim command line types the word under the cursorPastes the word under the cursor into a command or search you are typing in Vim.2 Dec 2026 - Tip
/oldname:%s//new/g in Vim replaces whatever you searched for lastAn empty pattern in a substitute command reuses your last search, so you can look first and replace after.2 Dec 2026 - Tip
find . -name "*.conf" | vim -Command | vim – opens the output of a command in a Vim bufferReads text from a pipe into a new Vim buffer so you can search and edit it.2 Dec 2026 - Tip
vim --clean file.txtvim --clean starts Vim without your vimrc and pluginsStarts Vim with default settings and no personal config, to find out whether your setup causes a problem.2 Dec 2026 - Tip
:set textwidth=72Gq with textwidth makes Vim rewrap long lines of textRewraps a paragraph or a selection to a fixed line width, such as 72 characters.2 Dec 2026 - Tip
:mksession:mksession saves your Vim windows and files, and vim -S brings them backSaves the open files and window layout to a file so you can restore it later.2 Dec 2026 - Tip
view /etc/fstabview opens a file in Vim in read-only modeOpens a file with Vim's navigation and search, but blocks accidental saves.2 Dec 2026 - Tip
:ExVim's :Ex browses the folder of the file you are editingOpens a file browser inside Vim to pick another file.30 Nov 2026 - Tip
:browse oldfilesVim's :browse oldfiles reopens a file you edited recentlyPicks a recently edited file from a numbered list.30 Nov 2026 - Tip
Ctrl-oCtrl-o in Vim takes you back to where you jumped fromReturns to previous cursor spots after a search or a jump.30 Nov 2026 - Tip
"0p"0p in Vim pastes what you yanked, even after deletingPastes your last copy even after a delete replaced it.30 Nov 2026 - Tip
gvgv in Vim selects the last visual selection againBrings back your previous selection to work on it again.30 Nov 2026 - Tip
:%!sort -uVim's :%! runs the whole file through a shell commandReplaces lines in the buffer with the output of a command.30 Nov 2026 - Tip
gg=GGg=G in Vim fixes the indentation of the whole fileRe-indents a file using Vim's indent rules for the language.30 Nov 2026 - Tip
** in Vim searches for the word under the cursorJumps to the next place a word appears without typing it.30 Nov 2026 - Tip
gfgf in Vim opens the file whose name is under the cursorOpens a path from your text without typing it.30 Nov 2026 - Tip
:bufdo %s/oldhost/newhost/ge | updateVim's :bufdo runs one command in every open fileApplies the same change to all buffers in one go.30 Nov 2026 - Tip
:set ff=unixSet ff=unix in Vim removes Windows line endingsConverts a file with Windows line endings back to Unix ones.30 Nov 2026 - Tip
gaga in Vim shows the code of the character under the cursorIdentifies odd characters by their decimal, hex and octal code.30 Nov 2026 - Tip
:vsplit config.example.ymlVim's :vsplit shows two files side by sidePuts files next to each other in one Vim screen.30 Nov 2026 - Tip
:vimgrep /TODO/ **/*.pyVim's :vimgrep searches many files and :copen lists the hitsSearches a whole project from inside Vim and jumps through results.30 Nov 2026 - Tip
Ctrl-r =19*23<Enter>Ctrl-r = in Vim insert mode types the result of a calculationCalculates something and inserts the answer while you type.30 Nov 2026 - Tip
gUiwGU and gu in Vim change text to upper or lower caseChanges the case of a word, a line or a selection.30 Nov 2026 - Tip
mama sets a mark in Vim and 'a jumps back to itBookmarks a spot in a file so you can return to it.30 Nov 2026 - Tip
Ctrl-vCtrl-v and I in Vim type the same text on many lines at onceAdds a prefix to a column of lines in one edit.30 Nov 2026 - Tip
/oldNameCgn and . in Vim replace matches one at a timeChanges the next search match, then repeats it where you choose.30 Nov 2026 - Tip
:set list listchars=tab:>-,trail:~,eol:$Set list in Vim shows tabs and trailing spacesMakes invisible whitespace visible while you edit.30 Nov 2026 - Tip
qaqa records a Vim macro and @a plays it backRecords a series of keystrokes once and repeats it on other lines.30 Nov 2026 - Tip
:set foldmethod=indentSet foldmethod=indent lets Vim fold code by its indentationCollapses indented blocks so you can see a file's outline.30 Nov 2026 - Tip
(move to the line with k, edit it)Q: in Vim opens your command history as a window you can editOpens your Vim command history as a buffer, so you can edit an old command and rerun it.28 Nov 2026 - Tip
set undofileset undofile keeps your Vim undo history after you close the fileSaves Vim undo history in a file so you can still undo after reopening the document.28 Nov 2026 - Tip
gi back to where you stopped typing, in Insert modegi in Vim returns to where you last typed and starts insertingJumps back to the place where you last left Insert mode and starts typing again there.28 Nov 2026 - Tip
:%s/error//gn:%s/pattern//gn counts matches in Vim without changing anythingCounts how many times a pattern appears in the file, using the substitute command's n flag.28 Nov 2026 - Tip
Ctrl-A add 1 to the number at or after the cursorCtrl-A in Vim adds one to a number, g Ctrl-A turns a column into a sequenceAdds to or subtracts from numbers in Vim, or numbers a list in one go.27 Nov 2026 - Tip
`. go to the last changeG; in Vim jumps back to where you last changed somethingJumps back to the places you edited in Vim, newest first.27 Nov 2026 - Tip
:%norm A;Vim's :%norm runs the same normal-mode keys on every lineRepeats a set of normal-mode keystrokes on every line in a range.27 Nov 2026 - Tip
:setlocal spell spelllang=en_us:setlocal spell turns on Vim's spell checker, and z= suggests the fixHighlights misspelled words in Vim and lets you pick a correction from a list.27 Nov 2026 - Tip
:g/^#/dVim's :g/pattern/d deletes all matching lines, :v the othersDeletes all lines containing a pattern, or all lines not containing it, in one command.25 Nov 2026 - Tip
:r !dateVim's :r !cmd inserts the output of a shell command into the bufferRuns a shell command and inserts what it prints below the current line.25 Nov 2026 - Tip
:sortVim's :sort orders lines, and can sort by number or drop duplicatesSorts the lines of a file or a selection, with options for numbers, case and duplicates.25 Nov 2026 - Tip
:waVim's :wa saves every changed buffer and :wqa saves them and quitsWrites all modified buffers to disk in one command, and optionally exits Vim.25 Nov 2026 - Tip
:earlier 10m:earlier 10m takes a Vim file back to how it looked ten minutes agoJumps the text back or forward in time instead of stepping through undo one change at a time.24 Nov 2026
Network2
- Tip
vim +/listen /etc/nginx/nginx.confvim +/pattern opens a file at the first matchStarts Vim with the cursor on a line or search match.30 Nov 2026 - Tip
vimdiff nginx.conf nginx.conf.newvimdiff shows two files side by side and Vim copies changesCompares two files and moves differences between them.30 Nov 2026
Shell2
- Tip
:terminalVim's :terminal opens a shell in a split windowRuns a shell or a command inside Vim, next to your file.30 Nov 2026 - Tip
:w !sudo tee % > /dev/null:w !sudo tee % saves a file you opened without sudoSaves a file that vim opened without permission, using sudo from inside the editor.19 Nov 2026
AI1
Nothing matches.