How do I refresh the diff highlighting in Vim when it becomes stale after editing?
After making edits in a vimdiff session, the diff highlighting can become out of sync with the actual content — showing incorrect change markers or missing hu
category:
buffers-windows
tags:
#buffers-windows
#diff
#editing
How do I open a file in read-only mode so I cannot accidentally modify it?
:view opens a file with the readonly option set, preventing accidental writes.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
How do I reorder tab pages in Vim without specifying an absolute position?
:tabmove normally takes an absolute position (:tabmove 0 moves the tab to the far left), but it also accepts relative offsets using + and -.
category:
buffers-windows
tags:
#tabs
#buffers-windows
#ex-commands
How do I keep the cursor column synchronized across two split windows while comparing files?
:set cursorbind (or :setlocal cursorbind) locks the cursor's column position so it moves in sync across all windows that have cursorbind enabled.
category:
buffers-windows
tags:
#buffers-windows
#windows
#navigation
How do I selectively accept LOCAL or REMOTE changes in a three-way git merge using Vim?
When Vim is configured as a git mergetool, it opens a three-way split with the LOCAL (your branch), REMOTE (their branch), and MERGED (the output file) buffers.
category:
buffers-windows
tags:
#buffers-windows
#diff
#editing
#command-line
How do I run the same Ex command in every open tab page at once?
The :tabdo {cmd} command executes an Ex command in each open tab page sequentially, visiting every tab and running the command there.
category:
buffers-windows
tags:
#tabs
#buffers
#ex-commands
#buffers-windows
How do I prevent the cursor from jumping when opening a split in Neovim?
Controls how Neovim preserves the visual position of content when creating, closing, or resizing horizontal splits.
category:
buffers-windows
tags:
#windows
#splits
#neovim
#config
#buffers
How do I open the previous file I was editing in a split window?
In Vim, # is a special filename that always refers to the alternate file — the most recently active buffer before the current one.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#editing
How do I save and restore my entire Vim session including open buffers, windows, and layout?
:mksession saves a snapshot of the current Vim session — all open buffers, window splits, tab pages, cursor positions, and folds — to a file called Session.
category:
buffers-windows
tags:
#buffers-windows
#tabs
#config
#ex-commands
How do I jump to a tag definition in a new split window instead of the current buffer?
Pressing g jumps to the definition of the tag under the cursor — just like — but opens the destination in a new horizontal split window.
category:
buffers-windows
tags:
#navigation
#buffers
#windows
#tags
How do I see a diff of my unsaved changes compared to the version on disk?
The command :w !diff % - pipes the current buffer's contents to an external diff command that compares it against the saved file on disk.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#editing
#navigation
How do I open a file in a split window and jump directly to the first match of a pattern?
The +{cmd} syntax lets you run an Ex command immediately after a file is opened.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#ex-commands
How do I open any split command's result in a new tab instead of a split window?
Most commands that open a new window (:help, :split, :new, :terminal) open a horizontal split by default.
category:
buffers-windows
tags:
#tabs
#buffers
#windows
#ex-commands
How do I run a command on all open buffers at once?
:bufdo executes an Ex command in each open buffer in sequence, cycling through every buffer in the buffer list.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
#batch
How do I open all loaded buffers into split windows at once?
The :sball command (short for split all) opens every loaded buffer in its own horizontal split window in one shot.
category:
buffers-windows
tags:
#buffers-windows
#buffers
#windows
#tabs
How do I make Vim reuse an existing window when jumping to a buffer instead of opening a new split?
The switchbuf option controls how Vim decides where to display a buffer when switching to it via commands like :sb, :cc, :cn, quickfix jumps, or .
category:
buffers-windows
tags:
#buffers-windows
#navigation
#ex-commands
#config
How do I control exactly what Vim saves when I create a session with :mksession?
The sessionoptions option (abbreviated ssop) is a comma-separated list of flags that determine what :mksession stores in the session file.
category:
buffers-windows
tags:
#buffers-windows
#config
#workflow
#sessions
How do I load multiple files matching a pattern into Vim for batch editing?
The :args command populates Vim's argument list with files matching a glob pattern, turning any set of files into a navigable list and enabling project-wide bat
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
#navigation
How do I open a file for reference in a dedicated preview window without disturbing my split layout?
Vim has a built-in preview window — a special window distinct from regular splits.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#ex-commands
How do I execute Ctrl-W window commands from the command line or a Vimscript function?
:wincmd {key} executes any {key} window command from the Ex command line or from inside a Vimscript function.
category:
buffers-windows
tags:
#windows
#ex-commands
#buffers-windows