How do I move all lines matching a pattern to the end of the file in Vim?
The :g (global) command combined with :m (move) lets you collect all lines matching a pattern and relocate them to a specific position in the file.
category:
command-line
tags:
#ex-commands
#editing
#global
#search
#formatting
How do I align columns in a visual selection using an external command?
:'<,'>!awk '{printf "%-20s %s\n", $1, $2}'
By piping a visual selection through awk with printf formatting, you can align columns to fixed widths.
category:
visual-mode
tags:
#visual-mode
#formatting
#alignment
#external-command
How do I auto-format code on save using conform.nvim?
:lua require('conform').format()
conform.
category:
plugins
tags:
#plugins
#formatting
#conform
#neovim
How do I center or right-align text to a specific width in Vim?
Vim has built-in text alignment commands that adjust lines relative to a specified width.
category:
editing
tags:
#editing
#alignment
#formatting
#text
How do I control automatic text wrapping and comment formatting in Vim?
The formatoptions setting controls how Vim automatically formats text as you type — including comment continuation, auto-wrapping, and paragraph formatting.
category:
config
tags:
#config
#formatting
#comments
#text-wrapping
How do I align text around a delimiter character using vim-lion?
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
category:
plugins
tags:
#plugins
#editing
#formatting
How do I make wrapped lines preserve their indentation level?
When wrap is enabled, long lines wrap to the next screen row starting at column 1 by default, which makes indented code look messy.
category:
config
tags:
#config
#formatting
#indentation
How do I make Vim wrap long lines at word boundaries instead of mid-word?
By default, when wrap is enabled, Vim wraps long lines at the window edge — which can split words in the middle.
category:
config
tags:
#config
#formatting
#indentation
How do I use ALE to automatically lint and fix code in Vim?
ALE (Asynchronous Lint Engine) is a popular Vim plugin that runs linters and formatters asynchronously in the background, showing errors and warnings in the gut
category:
plugins
tags:
#plugins
#linting
#formatting
How do I break a line at the cursor position without entering Insert mode?
You can split a line at the cursor without entering Insert mode by using r.
category:
editing
tags:
#editing
#normal-mode
#formatting
How do I hide or conceal syntax elements like markdown formatting in Vim?
The conceallevel option controls how Vim displays characters that have the "conceal" syntax attribute.
category:
config
tags:
#config
#formatting
How do I center-align text within a specific width in Vim?
The :center command pads a line with leading spaces so the text is centered within a given width.
category:
editing
tags:
#formatting
#ex-commands
#editing
How do I set the maximum line width for automatic text wrapping?
The textwidth option sets the maximum width for text.
category:
config
tags:
#config
#formatting
#ex-commands
How do I highlight trailing whitespace with a custom color in Vim?
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
category:
config
tags:
#editing
#formatting
#search
How do I add custom functions to Vim's statusline for dynamic information?
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
category:
config
tags:
#editing
#formatting
How do I set a colorscheme with a fallback in case it is not installed?
try | colorscheme gruvbox | catch | colorscheme default | endtry
How it works When you share your vimrc across multiple machines, a colorscheme you have installed on one system may not exist on another.
category:
config
tags:
#editing
#formatting
How do I toggle line wrapping on or off in Vim?
:set wrap! or :set nowrap
How it works By default, Vim wraps long lines that extend past the window width, displaying them across multiple screen lines.
category:
config
tags:
#visual-mode
#formatting
#navigation
How do I convert all tabs to spaces in a file in Vim?
How it works The :retab command replaces all tab characters in the current buffer with the appropriate number of spaces, based on your current tabstop and expan
category:
editing
tags:
#editing
#ex-commands
#formatting
How do I filter a visual selection through an external shell command?
How it works Vim can pipe selected text through any external shell command, replacing the selection with the command's output.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#formatting
How do I use a macro to align text on a specific character like the equals sign?
qa0f=20i <Esc>20|C= <Esc>lDjq
How it works Aligning text on a delimiter such as = without plugins requires a clever macro technique.
category:
macros
tags:
#macros
#editing
#formatting
#normal-mode