How do I close all folds and then open just the one containing the cursor to focus on it?
zMzv
The zMzv sequence collapses every fold in the file and then re-opens only the one containing your cursor.
2277 results for "@a"
zMzv
The zMzv sequence collapses every fold in the file and then re-opens only the one containing your cursor.
:silent !{cmd}
Running :!cmd in Vim shows the command's output and then pauses with a "Press ENTER or type command to continue" prompt.
:ab teh the
Vim's abbreviation system automatically expands short text sequences as you type, making it perfect for auto-correcting typos, inserting boilerplate snippets, o
config #editing #insert-mode #config #productivity #auto-correct
"adiw then move, "aP and diw
Delete the first word into register a with "adiw, move to the second word, paste register a before with "aP, then delete the remaining original.
:wincmd r
When a split layout is correct but the window positions are awkward, you do not need to close and reopen anything.
J
The J command joins the current line with the line below it, replacing the newline with a space.
g+
Vim's undo history is a tree, not a linear stack.
"_d{motion}
Vim's black hole register (") acts as a write-only sink: anything sent to it is discarded without affecting any other register, including the unnamed register (
:InspectTree
Opens an interactive split window showing the treesitter parse tree for the current buffer.
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
:set cedit=<C-y>
Vim's command-line window is invaluable for editing long : commands, search patterns, and complex substitutions with normal-mode tools.
:set wildignorecase
:set wildignorecase makes Vim's command-line tab completion treat uppercase and lowercase letters as equivalent when completing file names, buffer names, and ot
<C-o>
The (Ctrl+o) command jumps the cursor backward through the jump list, returning you to previous cursor positions.
:args **/*.js | argdo %s/old/new/ge | update
The argument list (arglist) is Vim's mechanism for loading a set of files and running commands across all of them.
command-line #command-line #ex-commands #arglist #productivity #batch #editing
:set spelloptions=camel
By default, Vim treats camelCase as a single word and flags it as a spelling error even when both camel and case are correctly spelled.
:e %:h
The command :e %:h opens netrw (Vim's built-in file browser) in the directory that contains the current file.
command-line #command-line #navigation #buffers #netrw #editing
g; / g,
The g; and g, commands let you navigate Vim's changelist — a per-buffer history of every position where you made a change.
navigation #navigation #changelist #editing #normal-mode #marks
:Man {name}
Neovim ships with a built-in :Man command (the man.
command-line #neovim #navigation #documentation #command-line
:set foldcolumn=auto:3
If you use folds heavily, a fixed fold column is a tradeoff: foldcolumn=0 hides useful fold cues, while a constant width wastes horizontal space in files that b
zz
The zz command scrolls the window so that the current cursor line appears in the middle of the screen.