How do you create a quick mapping to toggle between buffers?
nnoremap <leader>b :b#<CR>
Map b to :b# which switches to the alternate buffer.
261 results for ":b#"
nnoremap <leader>b :b#<CR>
Map b to :b# which switches to the alternate buffer.
set wildcharm= then nnoremap b :b
wildcharm sets the key that triggers wildmenu expansion inside mappings.
[q, ]q, [b, ]b (vim-unimpaired)
vim-unimpaired by Tim Pope provides consistent bracket mappings for navigating paired items like quickfix entries, buffers, and more.
:b name
Use :b with a partial filename.
[b and ]b
The vim-unimpaired plugin by Tim Pope adds symmetric [ and ] bracket mappings for navigating common Vim lists.
plugins #navigation #buffers #quickfix #plugins #normal-mode
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
:nnoremap ]b :bnext<CR>
Mapping ]b and [b to :bnext and :bprev creates an intuitive bracket-style navigation for buffers, matching the convention used by unimpaired.
buffers-windows #buffers-windows #navigation #mapping #buffers
:b {number}
The :b command followed by a buffer number switches directly to that buffer.
:let @b = @a
The :let @b = @a command copies the contents of register a into register b.
:'a,'b s/old/new/g
Marks can be used as range specifiers in any Ex command.
command-line #marks #command-line #ex-commands #ranges #editing
@a (within macro @b)
Vim macros can call other macros, enabling modular macro composition.
:b partial<Tab>
The :b (buffer) command accepts partial filename matching with tab completion.
:call setreg('b', getreg('a'), getregtype('a'))
Plain register copies like :let @b = @a move text, but they can lose important metadata about register type.
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
:call setreg('a', "foo\nbar", 'b')
Most register examples focus on interactive yanks, but setreg() lets you construct registers programmatically, including their type.
:b N
How it works Every buffer in Vim is assigned a unique number when it is opened.
b
The b command moves the cursor backward to the beginning of the previous word.
:let @q = @a . @b
Macros in Vim are stored as plain text in named registers.
:set complete=.,w,b,t
Default keyword completion can feel noisy in large projects because Vim may scan extra sources you do not care about in the moment.