Skip to content
shinokada edited this page Feb 28, 2014 · 1 revision

Track open files with the buffer list

Tip 36

$ cd code/files
$ vim *.txt
# only one file is visible
# run to see other files
:ls

switch to the next buffer

:bnext
:ls

% symbol indicates which of the buffers is visible in the current window. # symbol represents the alternate file. We can toggle between the current and alternate files by <C-^>, on Mac <C-6>.

# jump to the start
:bfirst 
# jump to the end
:blast
# switch to the previous buffer
:bprev # or :bp
# switch to the next buffer
:bnext # or :bn
# jump to a buffer with number N
:buffer N
# useing buffer name
:buffer {buffer name}

Using unimpaired.vim

nnoremap <silent> [b :bprevious<CR> 
nnoremap <silent> ]b :bnext<CR> 
nnoremap <silent> [B :bfirst<CR> 
nnoremap <silent> ]B :blast<CR>

Deleting Buffers

:bdelete N1 N2 N3
:N,M bdelete
Clone this wiki locally