How do I reformat text to fit the line width without moving the cursor?
gwip
The gw operator reformats text just like gq, but leaves the cursor in its original position after reformatting.
gwip
The gw operator reformats text just like gq, but leaves the cursor in its original position after reformatting.
[m
The [m motion jumps backward to the start of the nearest enclosing or preceding method definition.
[[
The [[ and ]] commands navigate between top-level code blocks — specifically, lines where { appears in column 1.
[[ and ]]
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
]m / [m
Vim's ]m and [m motions navigate between method and function boundaries in curly-brace languages like C, Java, JavaScript, and Go.
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
{count}<C-a> / {count}<C-x>
While increments and decrements a number by 1, you can prefix either with a count to add or subtract a specific amount.
v_o
When you start a visual selection, the cursor is at one end and the anchor is at the other.
[{ / ]}
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
]m and [m
The ]m and [m motions let you jump forward and backward between the start of method or function definitions.
: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.
]m / [m / ]M / [M
When navigating large source files, ]m and [m let you jump directly to the start of the next or previous method.
<C-o>{command}
While typing in insert mode, you sometimes need to do a quick normal-mode action — center the screen, jump to a mark, or delete a word backward.
o (in Visual mode)
When you make a Visual selection in Vim, the cursor sits at one end while the other end is anchored.
v3aw
In visual mode, repeating text object motions progressively expands the selection.
( ) { } [[ ]]
Vim provides structural navigation motions that move by sentences, paragraphs, and sections.
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
gj and gk
When wrap is enabled, long lines wrap across multiple screen lines.
{count}{motion}
Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action.
^ vs 0
Vim has two distinct motions for moving to the start of a line: 0 goes to column 1 (the absolute start), while ^ goes to the first non-blank character.
navigation #navigation #motions #line-navigation #indentation