How do I replace a visual selection with yanked text without losing my clipboard?
When you paste over a visual selection with p, Vim replaces the selection with the register contents — but it also puts the deleted selection into the unnamed
category:
visual-mode
tags:
#visual-mode
#registers
#paste
#workflow
How do I progressively expand or contract a visual selection by text objects?
In visual mode, repeating text object motions progressively expands the selection.
category:
visual-mode
tags:
#visual-mode
#text-objects
#selection
#motions
How do I copy selected text to the clipboard in visual mode?
In visual mode, pressing y yanks (copies) the selected text into the default register.
category:
visual-mode
tags:
#visual-mode
#registers
#editing
How do I change the case of selected text in visual mode?
U, u, or ~ in visual mode
How it works When you have text selected in visual mode, you can change its case with three simple keys: U - Convert the entire selection to UPPERCASE u - Conve
category:
visual-mode
tags:
#visual-mode
#editing
#formatting
How do I replace every character in a visual selection with a single character?
In visual mode, pressing r followed by a character replaces every character in the selection with that single character.
category:
visual-mode
tags:
#visual-mode
#editing
#replace
#selection
How do I create incrementing number sequences in Vim?
The g command increments numbers across a visual selection so that each subsequent line gets a progressively higher value.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I move the cursor to the other end of a visual selection to adjust it?
When you start a visual selection, the cursor is at one end and the anchor is at the other.
category:
visual-mode
tags:
#visual-mode
#navigation
#editing
#motions
How do I search for visually selected text?
To search for the exact text you have selected in visual mode, yank it and paste it into the search prompt.
category:
search
tags:
#search
#visual-mode
#registers
How do I search for an exact multi-word phrase or special text I've selected?
In normal mode, searches for the word under the cursor with word-boundary anchors.
category:
search
tags:
#search
#visual-mode
#navigation
How do I replace all characters in a visual block with one character?
In visual block mode, pressing r followed by a character replaces every character in the selected rectangle with that character.
category:
visual-mode
tags:
#visual-mode
#editing
How do I adjust the width of a visual block selection without restarting it?
In visual block mode (), pressing O (uppercase) moves your cursor to the other end of the current line — letting you expand or contract the block's horizontal
category:
visual-mode
tags:
#visual-mode
#visual-block
#selection
#editing
How do I indent or unindent selected lines in visual mode?
How it works In visual mode, you can shift selected lines to the right or left using the > and to indent them or or shifts the selected lines one shiftwidth to
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#formatting
How do I append text at the end of lines with different lengths using visual block?
When lines have varying lengths, a normal visual block selection stops at the shortest line.
category:
visual-mode
tags:
#visual-mode
#editing
#block-mode
#append
How do I reindent a block of code using a visual selection?
After making a visual selection, pressing = applies Vim's auto-indent to every selected line at once.
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#formatting
How do I select a rectangular block of text in Vim?
The (Ctrl+v) command enters visual block mode, which lets you select a rectangular column of text across multiple lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I add line numbers to multiple lines using visual block?
Visual block insert can add numbered prefixes to lines.
category:
visual-mode
tags:
#visual-mode
#editing
How do you select a rectangular column of text?
Press for visual block mode, then use movement keys to select a rectangle.
category:
visual-mode
tags:
#visual
#block
#column
How do I apply a recorded macro to every line in a visual selection?
Combining :normal with a visual range lets you replay a macro on each line of a selection individually — far more targeted than recursive macros or @@ repeati
category:
macros
tags:
#macros
#ex-commands
#normal-mode
#visual-mode
How do you paste over selected text without losing the yanked text?
Use "_dP which deletes the selection into the black hole register and pastes before.
category:
visual-mode
tags:
#visual
#paste
#preserve
How do I expand a visual selection to include the outer block?
In visual mode, you can expand your selection to include outer nested blocks by pressing additional text object commands.
category:
visual-mode
tags:
#visual-mode
#text-objects