How do I open a file under the cursor in a new split and jump to its line number in Vim?
F opens the filename under the cursor in a new horizontal split window and jumps to the line number that follows the filename.
category:
buffers-windows
tags:
#navigation
#buffers-windows
#windows
#editing
How do I mark multiple files in netrw and batch copy or move them to another directory?
Netrw, Vim's built-in file browser, supports a full marking system that lets you select multiple files and then perform bulk copy, move, or delete operations on
category:
buffers-windows
tags:
#buffers-windows
#navigation
#editing
How do I read or modify the lines of a buffer that is not currently displayed without switching to it?
getbufline() / setbufline()
The getbufline() and setbufline() functions let you inspect and update any loaded buffer's contents from Vimscript without switching the active window.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I allow split windows to collapse completely to just their status line?
By default, Vim enforces a minimum window height of 1 line, which means you can never fully collapse a split.
category:
buffers-windows
tags:
#buffers-windows
#windows
#splits
#navigation
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
How do I save and automatically restore a buffer's fold state and cursor position across Vim sessions?
:mkview saves a snapshot of the current window — its fold states, cursor position, and local option values — to a view file on disk.
category:
buffers-windows
tags:
#folding
#buffers-windows
#config
#ex-commands
How do I prevent a window from switching to a different buffer in Neovim?
Neovim's winfixbuf option (added in Neovim 0.
category:
buffers-windows
tags:
#neovim
#buffers
#windows
#config
How do I close a preview window from any other window without having to jump to it first?
Pressing z closes the preview window from any window in the current tab page.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#normal-mode
How do I save my current window and return to it after navigating other windows from a script or function?
:let winid = win_getid() | ... | call win_gotoid(winid)
The wingetid() and wingotoid() functions let you bookmark a window by its stable integer ID and jump back to it reliably.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#macros
How do I make Vim reuse an already-open window or tab when jumping to a quickfix entry?
:set switchbuf=useopen,usetab
By default, Vim opens a new window (or reloads the buffer in the current window) whenever you navigate to a quickfix entry, tag, or :buffer command — even if
category:
buffers-windows
tags:
#buffers-windows
#quickfix
#options
#config
How do I discard all unsaved changes and reload the file from disk in Vim?
:e! forces Vim to reload the current file from disk, discarding every unsaved change in the buffer.
category:
buffers-windows
tags:
#buffers-windows
#editing
#undo-redo
#ex-commands
How do I open a file in a read-only split window in Vim?
The :sview command opens a file in a horizontal split window with the buffer set to read-only.
category:
buffers-windows
tags:
#buffers-windows
#windows
#navigation
#ex-commands
How do I pull a diff change from another window into the current buffer in Vim?
The do command (diff obtain) is shorthand for :diffget.
category:
buffers-windows
tags:
#diff
#buffers
#editing
#normal-mode
How do I always maximize the current split window when I switch focus without using plugins?
:set winwidth=999 winheight=999
Setting winwidth=999 and winheight=999 tells Vim to try to make the active window at least 999 columns wide and 999 rows tall whenever it gains focus.
category:
buffers-windows
tags:
#windows
#config
#buffers
How do I prevent accidental edits to a buffer by making it completely read-only?
:set nomodifiable locks a buffer so that no changes can be made at all — not even temporary ones.
category:
buffers-windows
tags:
#buffers
#editing
#normal-mode
#ex-commands
How do I see a summary of all previous quickfix lists from my current session and navigate between them?
Every time you run :grep, :vimgrep, :make, or :cexpr, Vim creates a new quickfix list and pushes the previous one onto a history stack.
category:
buffers-windows
tags:
#buffers-windows
#quickfix
#navigation
#ex-commands
How do I turn off diff mode in all windows at once after comparing files?
The :diffoff! command exits diff mode in every window simultaneously.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#editing
How do I jump directly to the top-left or bottom-right window in a complex split layout?
When managing multiple splits, t jumps to the top-left window and b jumps to the bottom-right window.
category:
buffers-windows
tags:
#windows
#navigation
#buffers
How do I move my cursor into the preview window to interact with its contents?
The preview window is a special auxiliary split — usually at the top — opened by commands like :ptag, :pedit, and omni-completion to display reference infor
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#editing
How do I resize a split window by an exact number of columns or rows using a count in Vim?
All four window resize mappings accept an optional count prefix that multiplies the resize amount.
category:
buffers-windows
tags:
#windows
#buffers-windows
#normal-mode