How do I switch from the active command line into the command-line window to edit the command with full Vim power?
Pressing while you are already typing in the Vim command line (:), search line (/ or ?), or input prompt switches you into the command-line window with the curr
category:
command-line
tags:
#command-line
#ex-commands
#editing
#normal-mode
How do I scroll a full page up or down in Vim?
<C-f> to scroll forward, <C-b> to scroll backward
How it works Vim provides two commands for scrolling by an entire screen (page) at a time: Ctrl-F (Forward) scrolls the view one full page down through the file
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I open a file for reference in a dedicated preview window without disturbing my split layout?
Vim has a built-in preview window — a special window distinct from regular splits.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#ex-commands
How do I select or operate on a block of code based on its indentation level in Vim?
The vim-indent-object plugin by Michael Smith adds text objects based on indentation level, giving you ii (inner indent) and ai (an indent) to select, delete, c
category:
plugins
tags:
#plugins
#indent
#text-objects
#editing
#python
How do I browse and restore previously deleted text using Vim's numbered registers?
"1p then u. to cycle through delete history
Vim silently maintains a rolling history of your last 9 deletions in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
How do I open the command-line window while in the middle of typing a command?
While typing in Vim's command line (after pressing :), pressing opens the command-line window with your current, unfinished command already filled in.
category:
command-line
tags:
#command-line
#ex-commands
#editing
How do I delete from a visual block column to the end of each selected line?
In visual block mode, pressing C (uppercase) deletes from the leftmost column of the selection to the end of every selected line, then drops you into insert mod
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I move to the diagonally opposite corner of a blockwise visual selection?
In Visual-Block mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangular selection.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I jump to the next unmatched closing parenthesis?
The ]) command moves forward to the next unmatched ).
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I control the exact indentation amount for continuation lines when text wrapping is enabled?
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
category:
config
tags:
#config
#wrap
#indentation
#formatting
How do I use \zs and \ze to define the exact boundaries of a regex match in Vim?
Vim's \zs ("match start") and \ze ("match end") atoms let you narrow the actual match region within a broader pattern context.
category:
search
tags:
#search
#regex
#substitution
#patterns
#advanced
How do I allow the cursor to sit one position past the end of the line in normal mode?
By default, Vim's cursor cannot go past the last character of a line in normal mode — pressing $ lands on the final character, not after it.
category:
config
tags:
#config
#motions
#normal-mode
#editing
How do I open a file in a new tab in Vim?
The :tabnew filename command opens a file in a new tab page in Vim.
category:
buffers-windows
tags:
#buffers-windows
#tabs
#ex-commands
#navigation
How do I reformat a paragraph or visual selection to fit a specific line width?
The gq operator reformats text to fit within your configured textwidth.
category:
visual-mode
tags:
#visual-mode
#formatting
#editing
#text-objects
How do I jump forward through the jump list after going back with Ctrl-O?
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
category:
navigation
tags:
#navigation
#normal-mode
How do I change the cursor shape to a thin bar in insert mode and a block in normal mode in Neovim?
:set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20
Neovim's guicursor option lets you assign a distinct cursor shape and style to each mode, providing immediate visual feedback about which mode you are in.
category:
config
tags:
#config
#normal-mode
#insert-mode
#visual-mode
How do I stop Vim from replacing long lines with rows of '@' signs and show as much text as possible instead?
:set display+=lastline,truncate
By default, when a line is too long to fit in the window, Vim fills the remaining rows with @ characters to indicate the line continues off-screen.
category:
config
tags:
#config
#display
#long-lines
#wrap
#visual
How do I open the command-line window while typing a command on the : prompt?
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
category:
search
tags:
#command-line
#ex-commands
#editing
#normal-mode
How do I run a macro on every line in the file silently, ignoring errors on lines where the macro fails?
Combining :silent!, the % range, and :normal @q gives you a powerful pattern for applying a macro across an entire file while gracefully skipping lines that don
category:
macros
tags:
#macros
#editing
#ex-commands
#normal-mode
How do I resize the current window to an exact number of lines from the command line?
The z{height} command simultaneously resizes the current window to exactly {height} lines, scrolls so the current line sits at the top of the window, and moves
category:
buffers-windows
tags:
#buffers-windows
#windows
#resize
#navigation