How do I switch to the previous buffer in Vim?
:bprev
The :bprev (or :bp for short) command switches to the previous buffer in Vim's buffer list.
105 results for "buffer number"
:bprev
The :bprev (or :bp for short) command switches to the previous buffer in Vim's buffer list.
:filter /pattern/ ls
When you have many open buffers, plain :ls output gets noisy fast.
:setlocal statusline=%f\ %m\ %y\ [%l/%L]
The :setlocal statusline command lets you override the global statusline for a specific window.
onoremap ih :<C-u>execute "normal! ?^==\+$\r:noh\rkvg_"<CR>
Vim lets you define custom text objects using operator-pending mode mappings (onoremap) and visual mode mappings (vnoremap).
:%TOhtml
Vim ships with a built-in plugin that converts the current buffer into a standalone HTML file, complete with your exact syntax highlighting colors.
:setlocal {option}={value}
:setlocal sets an option only for the current buffer or window, leaving all other buffers and windows unaffected.
do
The do command (diff obtain) is shorthand for :diffget.
:tab sb N
How it works The :tab sb N command opens buffer number N in a brand new tab page.
:ls!
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
:set foldcolumn=3
The foldcolumn option adds a narrow column on the left side of the window that visually represents the fold structure of the file.
vim.api.nvim_buf_call()
vim.
:diffget 2
When Vim's diff mode has three or more buffers open, :diffget (or do) without an argument is ambiguous — Vim cannot determine which buffer to pull from.
:%s/#\zs\d\+/\=printf('%04d', submatch(0))/g
For log files, changelogs, or issue references, you sometimes need fixed-width numeric IDs without touching surrounding syntax.
editing #editing #ex-commands #substitute #regex #text-processing
mA / 'A
Uppercase marks (A-Z) are global marks — they remember not only the line and column position, but also the file where they were set.
navigation #navigation #marks #normal-mode #buffers #productivity
:history
:history displays a numbered list of your recently entered Ex commands, giving you a full audit of what you have run in the current session (and across sessions
:r filename
The :r filename command reads the contents of filename and inserts them into the current buffer below the cursor line.
:diffget / :diffput
When comparing two files side by side with :diffsplit or vim -d, you often want to pull specific changes from one file into another rather than accepting all di
<C-r>={expr}<CR>
The expression register ("=) lets you evaluate any Vimscript expression and insert the result directly into the buffer — all without leaving insert mode.
:m +1
The :move command (abbreviated :m) relocates lines to a new position in the buffer without touching any registers.
vim.keymap.set
vim.