How do I insert a register in Insert mode without reindenting each inserted line?
When you paste multiline snippets from a register while in Insert mode, default insertion can trigger indentation and formatting side effects line by line.
category:
registers
tags:
#registers
#insert-mode
#formatting
#indentation
#editing
How do I apply an Ex command only to the exact range of my last change or yank?
When you need to run a command on exactly the text you just changed, yanked, or pasted, Vim's automatic marks are faster and safer than reselecting manually.
category:
command-line
tags:
#command-line
#marks
#indentation
#ex-commands
#normal-mode
How do I insert the unnamed register literally in Insert mode without auto-indent side effects?
In Insert mode, plain {register} inserts register content but may reindent or auto-format depending on context.
category:
registers
tags:
#registers
#insert-mode
#editing
#indentation
#text
How do I reindent the previous visual selection and keep it selected?
When you are iterating on indentation, repeating selection steps is wasted motion.
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#formatting
#workflow
How do I convert space-indented code to tab-indented code in Vim?
:set noexpandtab | retab!
When you inherit space-indented code and need to switch to tabs, :retab! (with the bang) converts groups of spaces into tabs throughout the file.
category:
editing
tags:
#indentation
#editing
#ex-commands
#formatting
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 embed per-file Vim settings directly in a source file using modelines?
Vim's modeline feature lets you embed editor settings directly into a file.
category:
config
tags:
#config
#formatting
#indentation
How do I indent all lines from the cursor to the matching closing bracket in Vim?
Vim's > operator (indent) works with any motion or text object — including %, which jumps to the bracket, parenthesis, or brace matching the one under the cur
category:
editing
tags:
#editing
#indentation
#text-objects
#normal-mode
#motions
How do I shift-indent all lines from the current cursor position to the end of the file?
The >G command applies a right-indent shift to every line from the cursor through the last line of the buffer.
category:
editing
tags:
#editing
#indentation
#motions
#normal-mode
How do I force-convert all indentation including tabs in the middle of lines throughout an entire file?
The :retab command converts leading whitespace according to the current tabstop and expandtab settings, but it only touches indentation at the start of lines.
category:
editing
tags:
#editing
#indentation
#formatting
#ex-commands
How do I display multiple column guide lines at different widths simultaneously in Vim?
colorcolumn highlights one or more screen columns to serve as a visual ruler.
category:
config
tags:
#config
#formatting
#indentation
How do I visually display tabs, trailing spaces, and end-of-line characters in Vim?
:set list listchars=tab:>-,trail:~,eol:$
Enabling list mode makes Vim render normally invisible characters using configurable symbols defined in listchars.
category:
config
tags:
#config
#editing
#indentation
#formatting
How do I re-indent the entire paragraph under my cursor to match the surrounding code?
The =ip command combines Vim's auto-indent operator (=) with the inner paragraph text object (ip) to re-indent every line in the current paragraph in a single k
category:
editing
tags:
#editing
#indentation
#text-objects
#normal-mode
How do I make the indent width automatically match the tabstop setting without keeping them in sync manually?
Setting shiftwidth=0 tells Vim to use the value of tabstop wherever shiftwidth would normally be consulted — for the > and and in insert mode, and auto-indent
category:
config
tags:
#indentation
#config
#editing
#ex-commands
How do I insert a literal tab character in insert mode even when expandtab is enabled?
When expandtab is set, pressing the Tab key inserts spaces instead of a real tab character.
category:
editing
tags:
#insert-mode
#editing
#indentation
#tabs
How do I make the = operator use an external formatter instead of Vim's built-in indentation?
The equalprg option replaces Vim's built-in = indentation operator with any external formatting program.
category:
config
tags:
#config
#indentation
#formatting
#ex-commands
How do I make Vim's indent commands always align to a clean shiftwidth boundary?
shiftround causes indent commands (>, always adds exactly shiftwidth spaces to whatever indentation the line already has With shiftround: > rounds up to the nex
category:
config
tags:
#config
#indentation
#editing
How do I configure Tab and Backspace to always move by a fixed number of spaces when using expandtab?
When expandtab is enabled, Vim inserts spaces instead of a real tab character, but without softtabstop, Backspace only deletes one space at a time — not a ful
category:
config
tags:
#indentation
#config
#insert-mode
#editing
How do I right-align a block of text to a specific column width using an Ex command?
Vim has built-in Ex commands for text alignment — :right, :left, and :center — that work over any line range without plugins.
category:
command-line
tags:
#formatting
#indentation
#command-line
#ex-commands
How do I control when Vim automatically wraps text or continues comment markers with formatoptions?
The formatoptions setting is a string of single-character flags that governs Vim's automatic text formatting: when lines wrap, whether comment syntax continues
category:
config
tags:
#config
#formatting
#ex-commands
#indentation