How do I keep multiple split windows scrolling and cursoring in sync?
:windo setlocal scrollbind cursorbind
When reviewing related files side by side, alignment drifts quickly if each window scrolls independently.
category:
buffers-windows
tags:
#buffers-windows
#windows
#scrolling
#comparison
How do I jump to the previous change and reveal it clearly in Vim?
Jumping through the changelist with g; is useful, but in real files the destination can land inside a closed fold or off-center on screen, which slows review.
category:
navigation
tags:
#navigation
#changelist
#folding
#motions
How do I close all folds and then open just the one containing the cursor to focus on it?
The zMzv sequence collapses every fold in the file and then re-opens only the one containing your cursor.
category:
editing
tags:
#folding
#navigation
#normal-mode
How do I keep each search match centered and unfolded as I jump with n?
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.
category:
navigation
tags:
#navigation
#search
#folding
#normal-mode
How do I keep the cursor line always centered on the screen while scrolling?
By default, Vim only scrolls the viewport when the cursor reaches the very top or bottom of the screen.
category:
navigation
tags:
#navigation
#scrolling
#config
#cursor
#scrolloff
How do I scroll up half a page in Vim?
The (Ctrl+u) command scrolls the window up by half a screen, moving the cursor along with it.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I quickly jump between method or function definitions in code?
The ]m and [m motions let you jump forward and backward between the start of method or function definitions.
category:
navigation
tags:
#navigation
#motions
#normal-mode
#editing
How do I jump back in the jumplist and automatically reveal and center the destination?
Jumping backward with is fast, but in folded or dense files it can land you in a collapsed section or near the edge of the screen, forcing extra cleanup keystro
category:
navigation
tags:
#navigation
#jumplist
#folding
#normal-mode
How do I quickly resize the current window to exactly N lines tall in Vim?
The z{N} command sets the current window's height to exactly N lines and simultaneously positions the current line at the top of the window.
category:
buffers-windows
tags:
#buffers-windows
#windows
#navigation
How do I run a single normal mode command without fully leaving insert mode?
Pressing while in insert mode lets you execute exactly one normal mode command and then automatically returns you to insert mode.
category:
editing
tags:
#insert-mode
#editing
#normal-mode
How do I scroll down half a page in Vim?
The (Ctrl+d) command scrolls the window down by half a screen, moving both the viewport and the cursor.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I jump to the Nth line from the top or bottom of the visible screen using a count with H and L?
Most Vim users know H jumps to the first visible line, M to the middle, and L to the last.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I scroll through wrapped long lines smoothly without skipping screen rows?
The smoothscroll option makes scroll commands respect screen rows rather than buffer lines when wrap is enabled.
category:
config
tags:
#config
#navigation
#scrolling
#wrap
How do I open just enough folds to see the current line without expanding everything?
zv (view cursor) opens the minimum number of folds needed to make the current line visible — nothing more.
category:
editing
tags:
#folding
#navigation
#editing
How do I close the current window in Vim?
The c (Ctrl+w then c) command closes the current window without closing the buffer it contains.
category:
buffers-windows
tags:
#buffers-windows
#windows
#normal-mode
How do I move the cursor to the middle or bottom of the visible screen?
M to move to the middle, L to move to the bottom
How it works Vim offers three commands to jump the cursor to specific vertical positions on the visible screen without scrolling: H moves to the top of the scre
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I resize the current window to an exact number of lines from the command line?
The z{height} command simultaneously resizes the current window to exactly {height} lines, scrolls so the current line sits at the top of the window, and moves
category:
buffers-windows
tags:
#buffers-windows
#windows
#resize
#navigation