How do I jump to the last line of a file in Vim?
G
The G command moves the cursor to the last line of the file.
162 results for "{n}G"
G
The G command moves the cursor to the last line of the file.
:keeppattern s/old/new/g
When you run a :s or :g command, Vim updates the search register (@/) with the pattern you used.
\n in search, \r in replacement
Vim uses \n and \r differently depending on whether they appear in a search pattern or a replacement string, and mixing them up is a common source of confusion.
{count}n
Like most Vim motions, the n and N search repeat commands accept a count prefix.
g<C-g> (visual mode)
In visual mode, pressing g reports detailed statistics for the selected text only — word count, character count, and byte count.
{N}%
The {N}% command jumps the cursor to the line that is N percent of the way through the file.
<C-w>N
When using Vim's built-in :terminal, the buffer is in Terminal-Job mode by default, meaning all keystrokes go to the running shell.
:%s/^\(.\+\)\n\1$/\1/
This substitute command detects pairs of identical adjacent lines and collapses them into one, using a back-reference to match the repeated content.
/\%>5l\%<10l pattern
Vim's \%>{lnum}l and \%5l — matches only at positions after line 5 (i.
set foldlevelstart=N
When Vim opens a file with folds enabled, it uses the foldlevelstart option to decide how many fold levels to open automatically.
set complete=.,w,b,u,t
The complete option controls which sources Vim scans when you press or for generic keyword completion.
#
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
{count}go
The go command moves the cursor to a specific byte offset from the start of the buffer.
vim.keymap.set
vim.
g+
Vim's undo history is a tree, not a linear stack.
*
The command searches forward for the exact word under the cursor, jumping to the next occurrence.
g*
The g command searches forward for the text under the cursor without adding word boundary anchors.
search #search #navigation #normal-mode #motions #productivity
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
g* and g#
The and # commands search for the exact whole word under the cursor (with word boundaries \).
:oldfiles
:oldfiles displays a numbered list of every file Vim has recorded in its viminfo (or shada in Neovim) file.