How do I navigate and operate on sentences and paragraphs in Vim?
( / ) / { / }
Vim treats sentences and paragraphs as first-class navigation units.
navigation #navigation #motions #text-objects #prose #editing
( / ) / { / }
Vim treats sentences and paragraphs as first-class navigation units.
navigation #navigation #motions #text-objects #prose #editing
d<C-v>2j
Vim lets you override the natural type of any motion by pressing v, V, or between the operator and the motion.
editing #editing #motions #visual-mode #advanced #normal-mode
cin)
The targets.
s{char}{char}
The vim-sneak plugin by Justin Keyes provides a motion that lets you jump to any visible location by typing just two characters.
<Leader><Leader>w
The vim-easymotion plugin replaces Vim's default motion commands with a visual overlay system that lets you jump to any visible position on screen in just two o
/pattern/+3
Vim's search command accepts an offset after the pattern that shifts where the cursor lands relative to the match.
g*
The g command searches forward for the text under the cursor without adding word boundary anchors.
search #search #navigation #normal-mode #motions #productivity
; / ,
After using f, t, F, or T to jump to a character on the current line, pressing ; repeats the same search in the same direction, and , repeats it in the opposite
navigation #navigation #motions #normal-mode #editing #productivity
]] / [[
The ]] and [[ commands let you jump forward and backward between section boundaries, which in most programming languages correspond to function or method defini
navigation #navigation #motions #normal-mode #code #functions
gn
The gn motion searches forward for the next match of the last search pattern and visually selects it.
search #navigation #search #motions #normal-mode #repeat #editing
{N}%
The {N}% command jumps the cursor to the line that is N percent of the way through the file.
dap / dip
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
editing #editing #text-objects #normal-mode #delete #motions
` vs '
Vim offers two ways to jump to a mark, and the difference is crucial: the backtick (` `) jumps to the exact line and column where the mark was set, while the si
cis
The cis command deletes the entire sentence under the cursor and drops you into insert mode, ready to type a replacement.
ct{char}
The ct{char} command deletes everything from the cursor up to (but not including) the specified character and drops you into insert mode.
editing #editing #motions #normal-mode #text-objects #productivity
cw vs ciw
The cw and ciw commands both change a word, but they behave differently depending on cursor position.
editing #editing #text-objects #motions #normal-mode #productivity
<C-d>
The (Ctrl+d) command scrolls the window down by half a screen, moving both the viewport and the cursor.
<C-u>
The (Ctrl+u) command scrolls the window up by half a screen, moving the cursor along with it.
$
The $ command moves the cursor to the last character of the current line.
^
The ^ command moves the cursor to the first non-blank character of the current line.