How do I run the same command across all windows, buffers, or tabs?
Vim provides iterator commands that execute an Ex command across all windows, buffers, tabs, or argument list files.
category:
buffers-windows
tags:
#buffers-windows
#windo
#bufdo
#batch-commands
How do I hide a buffer from the buffer list without closing it?
Setting nobuflisted removes a buffer from the :ls output and buffer-switching commands like :bnext/:bprev, while keeping it loaded and accessible.
category:
buffers-windows
tags:
#buffers-windows
#buffers
#unlisted
#management
How do I close all tabs and buffers except the current one?
:tabonly | %bdelete | edit #
When your Vim session becomes cluttered with many tabs and buffers, you can clean up by closing all tabs except the current one with :tabonly, then deleting all
category:
buffers-windows
tags:
#buffers-windows
#cleanup
#tabs
#buffers
How do I make Vim automatically reload files changed outside the editor?
:set autoread | autocmd FocusGained * checktime
When working with Git, build tools, or collaborators, files may change outside Vim.
category:
buffers-windows
tags:
#buffers-windows
#autoread
#file-detection
#external-changes
How do I set up efficient keybindings for cycling through buffers?
Mapping ]b and [b to :bnext and :bprev creates an intuitive bracket-style navigation for buffers, matching the convention used by unimpaired.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#mapping
#buffers
How do I make a buffer completely read-only and unmodifiable?
While :set readonly prevents accidental writes, nomodifiable goes further by preventing any changes to the buffer contents entirely.
category:
buffers-windows
tags:
#buffers-windows
#readonly
#modifiable
#protection
How do I temporarily maximize a split window to full height or width?
When working with multiple splits, you sometimes need to focus on one window temporarily without closing the others.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#editing
How do I force Vim to check if open files were changed externally and reload them?
The :checktime command tells Vim to check whether any open buffers have been modified outside of Vim and prompt you to reload them.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
How do I run a command across all open buffers at once?
:bufdo %s/old/new/ge | update
The :bufdo command executes an Ex command in every loaded buffer.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
#substitution
How do I maximize a window to full height or make all windows equal size?
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#normal-mode
How do I incrementally grow or shrink a split window by a specific number of lines or columns?
:resize adjusts the height of the current window by a relative or absolute amount.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I open an existing buffer in a new split window?
The :sb (short for :sbuffer) command opens a buffer that is already loaded in Vim in a new horizontal split window.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
How do I list all buffers including unlisted ones like help pages and terminal buffers?
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I open a new empty buffer in a horizontal split without opening any file?
n creates a new empty buffer and opens it in a horizontal split above the current window.
category:
buffers-windows
tags:
#buffers-windows
#editing
How do I compare two files side by side using Vim's built-in diff mode?
:vertical diffsplit {file}
Vim has a built-in diff mode that highlights added, removed, and changed lines between two (or more) buffers.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#navigation
How do I navigate between errors and results in the quickfix list?
The quickfix list is Vim's built-in way to collect a list of positions — typically compiler errors, grep results, or linter warnings — and jump between them
category:
buffers-windows
tags:
#buffers
#ex-commands
#navigation
How do I open a file in a new tab in Vim?
Vim's tab pages let you keep separate window layouts open at the same time, each with its own set of splits.
category:
buffers-windows
tags:
#buffers
#tabs
#windows
#ex-commands
How do I resize split windows using the keyboard in Vim?
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
How do I open Vim help pages in a new tab instead of a split?
By default, :help opens in a horizontal split, which can feel cramped.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
How do you create a quick mapping to toggle between buffers?
nnoremap <leader>b :b#<CR>
Map b to :b# which switches to the alternate buffer.
category:
buffers-windows
tags:
#buffers
#mapping
#toggle