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 quickly configure Vim to parse compiler errors for a specific language using a built-in compiler plugin?
Vim ships with built-in compiler plugins for many languages and tools — including gcc, python, cargo, eslint, tsc, and more.
category:
command-line
tags:
#ex-commands
#config
#buffers-windows
#command-line
How do I step through the files in my argument list one at a time?
When Vim is opened with multiple files (e.
category:
command-line
tags:
#buffers-windows
#ex-commands
#navigation
#editing
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 display the full absolute path of the current file without leaving normal mode?
Pressing prints the current filename, buffer status, and cursor position in the status line.
category:
navigation
tags:
#navigation
#buffers-windows
#normal-mode
How do I suspend Vim to the background shell and return to it later?
Pressing in Vim sends it to the background of your shell session — just like suspending any Unix process.
category:
command-line
tags:
#command-line
#navigation
#buffers-windows
How do I add a per-window title bar showing the current file name in Neovim?
Neovim 0.
category:
config
tags:
#config
#buffers-windows
#statusline
#neovim
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 open a file in Netrw in a vertical split instead of the current window?
When browsing files in Vim's built-in file manager (Netrw), pressing v on any file opens it in a vertical split to the right.
category:
plugins
tags:
#buffers-windows
#navigation
#editing
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 diff the current file against a specific git commit using vim-fugitive?
vim-fugitive's :Gdiffsplit opens a vertical split showing the current file diff against any git revision — not just HEAD.
category:
plugins
tags:
#plugins
#diff
#git
#buffers-windows
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 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
How do I prevent Vim from automatically resizing a window when others open or close?
Setting winfixwidth on a window tells Vim not to adjust its width when other windows are created, closed, or resized with =.
category:
buffers-windows
tags:
#buffers-windows
#config
#editing
#windows
How do I execute Ctrl-W window commands from a Vimscript mapping or function without using :normal?
:wincmd is the Ex command equivalent of any keystroke.
category:
buffers-windows
tags:
#buffers-windows
#windows
#ex-commands
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 convert a horizontal split into a vertical split or move a window to the far side of the screen?
After opening a split you can dynamically reposition windows using H, J, K, and L.
category:
buffers-windows
tags:
#windows
#buffers-windows
#navigation
#normal-mode
How do I jump directly to a specific tab page by its number in Vim?
Prefixing gt (go to next tab) with a count jumps directly to the tab page at that position.
category:
buffers-windows
tags:
#tabs
#buffers-windows
#navigation
#normal-mode