How do I expand or shrink a visual selection to the next text object boundary?
v + repeated iw/aw/i(/a(/ip/ap
Once you enter visual mode, you can progressively expand your selection by typing increasingly larger text objects.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#selection
#productivity
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 invert the case of an entire paragraph with one operator command?
g~ap is a fast way to invert letter case across a full paragraph without entering Visual mode.
category:
editing
tags:
#editing
#operators
#text-objects
#case
#normal-mode
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 delete or change an entire paragraph of text in one motion?
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#delete
#motions
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 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 auto-indent a block of code in visual selection without specifying a line range?
Pressing = in visual mode re-indents all selected lines according to the current filetype's indent rules — the same engine used by == for a single line, but a
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#text-objects
How do I switch between charwise, linewise, and blockwise visual mode without losing my selection?
Once you are in any visual mode, pressing v, V, or switches to charwise, linewise, or blockwise visual mode respectively — without cancelling the current sele
category:
visual-mode
tags:
#visual-mode
#normal-mode
#editing
How do I reformat text to fit textwidth without moving the cursor from its current position?
The gw operator reformats text just like gq, but leaves the cursor exactly where it started.
category:
editing
tags:
#formatting
#editing
#normal-mode
#motions
How do I select, delete, or change a complete sentence using Vim's sentence text objects?
Vim defines sentence text objects — as (around sentence) and is (inner sentence) — that allow any operator to act on an entire sentence in one motion.
category:
editing
tags:
#text-objects
#editing
#normal-mode
#sentences