How do I make buffer-jump commands reuse an existing tab before opening a new one?
:set switchbuf=usetab,newtab
When you jump to buffers from quickfix, tags, or command-line completions, Vim's default window selection can feel unpredictable.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
#quickfix
#navigation
How do I open a file and jump directly to a specific line or pattern?
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
category:
command-line
tags:
#buffers
#ex-commands
#navigation
#command-line
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 open a related file with a different extension using the current filename?
In Vim's command line, % expands to the current buffer's filename.
category:
command-line
tags:
#ex-commands
#command-line
#buffers
#navigation
How do I jump to an already-open file window instead of opening duplicate buffers?
When the same file is already open elsewhere, using :edit can create extra navigation friction because you stay in the current window and may lose layout contex
category:
buffers-windows
tags:
#buffers-windows
#windows
#buffers
#workflow
How do I change the working directory for only the current window without affecting other windows or tabs?
:cd changes the global working directory, affecting every window and tab in the session.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
#navigation
How do I enable tab completion inside custom command-line mappings?
The wildcharm option designates a key that, when it appears inside a mapping, triggers wildmenu completion on the command line — just as if you had pressed in
category:
config
tags:
#config
#command-line
#completion
#mappings
How do I use the location list instead of the quickfix list to have per-window grep results?
The location list is a per-window counterpart to the global quickfix list.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#search
#navigation
How do I use the filename under the cursor as a value in a Vim mapping or command?
The expand('') function returns the filename that Vim sees under the cursor — the same file that gf would open.
category:
command-line
tags:
#command-line
#ex-commands
#navigation
#editing
#motions
How do I reference just the extension, stem, or directory of the current file in a Vim command?
Vim exposes the current filename as % in Ex commands, and you can apply modifiers to extract specific parts of the path.
category:
command-line
tags:
#command-line
#ex-commands
#files
#editing
How do I close all windows except the current one?
The :only command closes every window in the current tab page except the one your cursor is in.
category:
buffers-windows
tags:
#buffers-windows
#windows
#ex-commands
How do I switch between split windows in Vim?
The (Ctrl+w Ctrl+w) command cycles the cursor to the next window in the current tab.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#normal-mode
How do I use the leader key to create my own keyboard shortcuts?
let mapleader = ' ' then nnoremap <leader>key command
The leader key is a configurable prefix for your custom key mappings.
category:
config
tags:
#config
#mappings
#vimrc
#leader
#workflow
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
How do I move a split window into its own tab?
The T (Ctrl+w then Shift+t) command moves the current split window into a new tab page.
category:
buffers-windows
tags:
#buffers-windows
#windows
#tabs
#normal-mode
How do I define a custom user command in Neovim Lua config that accepts arguments and has a description?
vim.api.nvim_create_user_command()
Neovim's Lua API provides vim.
category:
config
tags:
#config
#neovim
#lua
#command-line
#ex-commands
How do I diff two buffers side by side in Vim?
The :windo diffthis command activates Vim's built-in diff mode across all visible windows, highlighting the differences between them.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#editing
How do I use tab pages in Vim to organize multiple files?
Vim's tab pages let you organize your workspace into separate views, each containing its own window layout.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
#navigation
#productivity