How do I insert all Vim messages into the current buffer so I can read, search, or save them?
:put =execute('messages')
Vim's :messages command shows recent output — error messages, echo'd values, and diagnostic information — but the display is ephemeral and hard to search.
category:
registers
tags:
#registers
#ex-commands
#debugging
#command-line
How do I save only real file buffers when running bufdo across many open buffers?
:bufdo if &buftype ==# '' | update | endif
bufdo is powerful for multi-buffer automation, but a naive write pass can error on special buffers (help, terminal, quickfix, prompts).
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
#automation
#workflow
How do I use the alternate file register to quickly reference the previous file?
"#p or <C-r># in insert mode
The # register always contains the name of the alternate file — typically the file you were editing just before the current one.
category:
registers
tags:
#registers
#buffers
#file-management
#workflow
How do I change the filename associated with the current buffer in Vim without saving to disk?
:file {newname} (short form: :f {newname}) changes the filename Vim associates with the current buffer.
category:
command-line
tags:
#buffers-windows
#command-line
#ex-commands
How do I view only command-history entries matching a pattern in Vim?
:filter /{pattern}/ history cmd
When command history gets crowded, scanning :history cmd manually is slow.
category:
command-line
tags:
#command-line
#history
#search
#workflow
How do I open the alternate buffer in a new split while keeping my current window unchanged?
If you often compare your current file against the previously visited buffer, replacing the current window is disruptive.
category:
buffers-windows
tags:
#buffers
#windows
#splits
#navigation
How do I switch to the next buffer in Vim?
The :bnext (or :bn for short) command switches to the next buffer in Vim's buffer list.
category:
buffers-windows
tags:
#buffers
#ex-commands
#navigation
How do I edit a file without overwriting the alternate buffer?
Every time you open a file with :edit, Vim updates the alternate file register (#) to the previous buffer.
category:
buffers-windows
tags:
#buffers
#ex-commands
#registers
#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 activate a configured language server in Neovim 0.11 for specific filetypes?
vim.lsp.enable('server-name')
vim.
category:
plugins
tags:
#lsp
#neovim
#plugins
#lua
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 open a scratch split that is not listed and disappears when I close it?
:vnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
For quick throwaway notes, command output cleanup, or temporary edits, a normal buffer is noisy: it appears in :ls, can prompt you to save, and may leave swap a
category:
buffers-windows
tags:
#buffers-windows
#buffers
#windows
#scratch
#workflow
How do I switch to the previous buffer in Vim?
The :bprev (or :bp for short) command switches to the previous buffer in Vim's buffer list.
category:
buffers-windows
tags:
#buffers
#ex-commands
#navigation
How do I insert the output of a shell command directly into my buffer?
:put =system('cmd') lets you insert the output of any shell command as new lines in your buffer without leaving Vim.
category:
command-line
tags:
#ex-commands
#shell
#registers
#editing
How to navigate between buffers, quickfix entries, and location list items using bracket pairs with vim-unimpaired?
The vim-unimpaired plugin by Tim Pope adds symmetric [ and ] bracket mappings for navigating common Vim lists.
category:
plugins
tags:
#navigation
#buffers
#quickfix
#plugins
#normal-mode
How do I quickly switch between the current file and the last file I was editing?
:e # opens the alternate file — the file you were editing just before the current one.
category:
buffers-windows
tags:
#buffers
#editing
#ex-commands
#navigation
How do I change the working directory to the folder containing the current file without affecting other windows?
:lcd %:p:h sets the working directory for the current window to the directory of the file you're editing, using Vim's path expansion modifiers.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#navigation
How do I open an existing buffer in a new tab page in Vim?
How it works The :tab sb N command opens buffer number N in a brand new tab page.
category:
buffers-windows
tags:
#buffers
#tabs
#ex-commands
#navigation
How do I browse and edit my backward search history in a full Vim buffer?
Vim provides three command-line history windows accessible from normal mode: q: for Ex commands, q/ for forward searches, and q? for backward searches.
category:
search
tags:
#search
#command-line
#navigation
How do I open the alternate file in a new split window without typing its name?
Press (Ctrl+W followed by Ctrl+6) to open the alternate file in a horizontal split.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#buffers