vim - buffer

时间:2021-03-17 04:19:24

1. buffer switching

http://vim.wikia.com/wiki/Easier_buffer_switching

:buffer
:ls
:files

2. vim default to delete a buffer, it causes closing the window also.
http://vim.wikia.com/wiki/Deleting_a_buffer_without_closing_the_window
:bdelete - close buffer and all windows currently showing the buffer

3. buffer deleting
https://github.com/qpkorr/vim-bufkill
Usage
Unloading/Deleting/Wiping
To unload a file from the buffer and keep the window/split intact:
:BUN

To delete a file from the buffer and keep the window/split intact:
:BD

To wipe a file from the buffer and keep the window/split intact:
:BW

Moving through buffers
To move backwards through recently accessed buffers:
:BB
and to move forwards:
:BF

To move to an alternate buffer and keep the cursor in the same column, use:
:BA

Also...

Can also override Ctrl-^ (Vim's default for swapping between alternate buffers) via g:BufKillOverrideCtrlCaret in your /.vimrc file.

Can overide the default mappings within your /.vimrc file like so:
map <C-c> :BD<cr>

resulting in being able to delete a file from the buffer via vim-bufkill with CTRL + c