How do I open the previous file I was editing in a split window?
:split #
In Vim, # is a special filename that always refers to the alternate file — the most recently active buffer before the current one.
261 results for ":b#"
:split #
In Vim, # is a special filename that always refers to the alternate file — the most recently active buffer before the current one.
/\V<C-r><C-r>"
When your yanked text includes regex symbols like .
:keepmarks %s/pattern/replacement/g
The :keepmarks modifier prevents Vim from adjusting mark positions when a buffer-modifying command runs.
:hide edit {file}<CR>
Normally, trying to :edit another file from a modified buffer triggers a warning and blocks the switch unless you save or force the command.
buffers-windows #buffers #windows #workflow #command-line #editing
:let @q = "dd"
Macros are just strings stored in named registers.
{count}go
The go command moves the cursor to a specific byte offset from the start of the buffer.
<C-u> (command line)
When you are typing a long Ex command on the : prompt and realise you've made a mistake, pressing erases everything from the cursor back to the beginning of the
command-line #command-line #ex-commands #editing #insert-mode
<C-x><C-d>
in insert mode triggers defined identifier completion — it searches for identifiers that match the partial word before the cursor by scanning #define statemen
:call setreg('q', 'dd')
The setreg() VimScript function lets you populate any register with arbitrary content directly from the command line or a script — no recording required.
:set wildoptions=pum
Setting wildoptions=pum tells Neovim to use its popup menu for command-line tab completion instead of the traditional horizontal wildmenu bar.
:set wildcharm=<Tab>
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
:set iskeyword+={char}
iskeyword defines which characters are considered word characters in Vim.
\&
Vim's \& operator is the AND combinator in a search pattern.
:lvimgrep /TODO/j **/* | lopen\<CR>
When you are working in multiple windows, quickfix can become noisy because it is shared globally across the editor session.
:%s/\<old\>/new/g
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
gl{motion}{char}
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
matchadd('Group', 'pattern', priority)
matchadd() accepts an optional third argument: a priority integer that controls which match wins when two patterns cover the same text.
:5t.
The :t ex command (also spelled :copy) copies a range of lines to a target address without touching any register.
setreg()
The setreg(reg, value, type) and getreg(reg, 1, 1) functions give you full programmatic control over registers, including their type (characterwise, linewise, o
:/pattern1/,/pattern2/
Ex command ranges in Vim are not limited to line numbers and marks — you can use /pattern/ as a range boundary to select lines between any two matching patter