How do I change the case of text using operators and motions?
gU{motion} / gu{motion} / g~{motion}
Vim has three case operators that work with any motion or text object: gU for uppercase, gu for lowercase, and g~ for toggle case.
category:
editing
tags:
#editing
#case
#operators
#text-objects
#normal-mode
How do I swap two regions of text without a complex yank-delete-paste workflow?
cx{motion} … cx{motion} (vim-exchange)
The vim-exchange plugin provides cx{motion} to mark a region, then cx{motion} again on a second region to swap them in place.
category:
plugins
tags:
#editing
#text-objects
#motions
#normal-mode
How do I force a Vim operator to act linewise even when the motion is normally characterwise?
In operator-pending mode — the brief state after typing an operator like d, c, or y but before entering the motion — you can prefix the motion with v, V, or
category:
editing
tags:
#editing
#motions
#normal-mode
#operators
How do I force a normally linewise motion to operate characterwise when combined with an operator?
In operator-pending mode — after typing an operator like d, y, or c but before the motion — you can press v, V, or to override the motion type to characterw
category:
editing
tags:
#editing
#motions
#normal-mode
#operators
How do I filter text through an external program using a motion in normal mode?
The ! operator in normal mode lets you pipe a range of text through any external program and replace it with the output.
category:
editing
tags:
#editing
#normal-mode
#ex-commands
#formatting
How do I create a custom operator that works with any motion in Vim?
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
category:
config
tags:
#config
#mapping
#normal-mode
#editing
How do I quickly comment and uncomment code with vim-commentary?
gcc (toggle line), gc{motion} (toggle range)
vim-commentary by Tim Pope provides a simple way to toggle comments.
category:
plugins
tags:
#plugins
#editing
How do I use count prefixes to amplify motions and operators in Vim?
Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action.
category:
navigation
tags:
#navigation
#motions
#count
#operators
How do I sort a range of lines by piping them through an external sort command using the ! operator?
The ! operator in Vim filters a motion's text through an external shell command, replacing it with the output.
category:
editing
tags:
#editing
#motions
#ex-commands
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 toggle, uppercase, or lowercase text using motion commands in Vim?
Vim has three case-change operators that work like any other operator — you can combine them with motions, text objects, or double them to act on the whole li
category:
visual-mode
tags:
#editing
#visual-mode
#normal-mode
#text-objects
How do I delete or change text without overwriting my previously yanked text?
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 (
category:
registers
tags:
#registers
#delete
#editing
#normal-mode
How do I filter a range of text through an external shell command in Vim?
The ! operator passes text selected by a motion through an external shell command, replacing it with the command's output.
category:
editing
tags:
#editing
#normal-mode
#ex-commands
How do I quickly toggle comments on lines of code in Vim?
The vim-commentary plugin by Tim Pope provides a simple, operator-based way to comment and uncomment code.
category:
plugins
tags:
#plugins
#editing
#normal-mode
#visual-mode
How do I filter a range of text through an external shell command directly in normal mode?
The ! operator in normal mode lets you pipe any motion's text through a shell command and replace it with the output.
category:
editing
tags:
#editing
#shell
#external-command
#normal-mode
#filtering
How do I replace a text object with the contents of a register in Neovim 0.11?
Neovim 0.
category:
editing
tags:
#editing
#registers
#text-objects
#normal-mode
How do I run a shell command on a range of lines in normal mode and replace them with the output?
In normal mode, !{motion} sends the lines covered by the motion to a shell command's stdin and replaces them with stdout.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
#formatting
How do I pipe a range of lines through an external command and replace them with the output?
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
#formatting
How do I hard-wrap or reformat a paragraph to fit the current textwidth?
The gq{motion} operator reformats text to fit within Vim's textwidth setting, inserting hard line breaks where lines are too long.
category:
editing
tags:
#editing
#formatting
#motions
#normal-mode
How do I force a motion to act blockwise, linewise, or characterwise?
Vim lets you override the natural type of any motion by pressing v, V, or between the operator and the motion.
category:
editing
tags:
#editing
#motions
#visual-mode
#advanced
#normal-mode