How do I reformat text to fit the line width without moving the cursor?
The gw operator reformats text just like gq, but leaves the cursor in its original position after reformatting.
category:
editing
tags:
#editing
#formatting
#motions
#text-objects
How do I make word motions like w, b, and e treat hyphens or other characters as part of a word?
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
category:
config
tags:
#config
#navigation
#motions
#text-objects
How do I change the case of a specific column of text using visual block mode?
Visual block mode lets you select rectangular regions of text, which means you can target a specific column and apply case changes only to that area.
category:
visual-mode
tags:
#visual-mode
#editing
#text-objects
#formatting
How do I fix the indentation of a code block without affecting surrounding code?
When editing code with messy indentation — after a paste, a merge conflict, or a refactor — you often need to fix just one block rather than the entire file
category:
editing
tags:
#editing
#indentation
#text-objects
#formatting
How do I move all lines matching a pattern to the top or bottom of a file?
The :global command combined with :move lets you restructure a file by relocating all lines that match a pattern.
category:
editing
tags:
#ex-commands
#editing
#text-objects
How do I reformat a paragraph or visual selection to fit a specific line width?
The gq operator reformats text to fit within your configured textwidth.
category:
visual-mode
tags:
#visual-mode
#formatting
#editing
#text-objects
How do I create a custom operator that works with motions and text objects?
:set operatorfunc=MyFunc<CR>g@
Vim lets you define custom operators that behave like built-in ones (d, c, y) — they wait for a motion or text object, then act on the selected region.
category:
config
tags:
#config
#normal-mode
#motions
#text-objects
#mapping
How do I reformat a paragraph to fit a specific line width in Vim?
The gq operator reformats text by wrapping lines to fit within the textwidth setting.
category:
editing
tags:
#formatting
#editing
#text-objects
#normal-mode
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 yank text inside delimiters into a specific named register?
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
category:
registers
tags:
#registers
#text-objects
#yank
#delimiters
How do I select functions, classes, and other code structures using Treesitter?
:TSTextobjectSelect @function.outer
The nvim-treesitter-textobjects plugin provides syntax-aware text objects powered by Treesitter's AST parsing.
category:
plugins
tags:
#plugins
#treesitter
#text-objects
#neovim
How do I select, change, or delete function arguments as text objects?
cia (with targets.vim) or daa
While Vim doesn't have a built-in argument text object, the targets.
category:
editing
tags:
#editing
#text-objects
#arguments
#plugins
How do I visually select a code block enclosed in curly braces including the braces themselves?
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
How do I visually select the text of a sentence without selecting surrounding whitespace?
The is (inner sentence) text object selects the sentence the cursor is in — excluding any leading or trailing whitespace that separates sentences.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
How do I visually select a double-quoted string including the quotes themselves?
Vim's text objects let you select structured regions of text with two-keystroke shortcuts.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
How do I visually select an entire sentence in Vim?
The vas command visually selects the current sentence, including surrounding whitespace.
category:
visual-mode
tags:
#visual-mode
#text-objects
#motions
How do I change surrounding quotes or brackets from one type to another with vim-surround?
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
category:
plugins
tags:
#plugins
#text-objects
#editing
How do I select text inside angle brackets?
The vi).
category:
visual-mode
tags:
#visual-mode
#text-objects
How do I delete a word and save it to a specific register?
The "adiw command deletes the inner word under the cursor and stores it in register a.
category:
registers
tags:
#registers
#editing
#text-objects
How do I change the content inside backticks?
The ` ci ` command changes the text inside backtick delimiters.
category:
editing
tags:
#editing
#text-objects
#normal-mode