vim中的buffer、tab、window说明
Vim :help window
explains the confusion "tabs vs buffers" pretty well.
A buffer is the in-memory text of a file.
A window is a viewport on a buffer.
A tab page is a collection of windows.
Opening multiple files is achieved in vim with buffers. In other editors (e.g. notepad++) this is done with tabs, so the name tab in vim maybe misleading.
Windows are for the purpose of splitting the workspace and displaying multiple files (buffers) together on one screen. In other editors this could be achieved by opening multiple GUI windows and rearranging them on the desktop.
Finally in this analogy vim's tab pages would correspond to multiple desktops, that is different rearrangements of windows.
As vim help: tab-page
explains a tab page can be used, when one wants to temporarily edit a file, but does not want to change anything in the current layout of windows and buffers. In such a case another tab page can be used just for the purpose of editing that particular file.
Of course you have to remember that displaying the same file in many tab pages or windows would result in displaying the same working copy (buffer).
用vim的tab代替隐藏的buff(暂时没成功)
:tab sball
- this opens a new tab for each open buffer.
:help switchbuf
- this controls buffer switching behaviour, try :set switchbuf=usetab,newtab
. This should mean switching to the existing tab if the buffer is open, or creating a new one if not.
切换和查看所有打开的buffers
- Use
:bn
,:bp
,:b #
,:b name
, andctrl-6
to switch between buffers. I likectrl-6
myself (alone it switches to the previously used buffer, or#ctrl-6
switches to buffer number#
). - Use
:ls
to list buffers, or a plugin like MiniBufExpl or BufExplorer.
各个打开的tabs之间进行切换
使用gt, gT,num+gt进行各个tabs之间的切换。
NERDTree:
"opening NERDTree automaticlly when open vim
autocmd vimenter * NERDTree
"opening NERDTree automaticlly only if open vim without specific file .
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
Tagbar:
Put something like the following into your ~/.vimrc:
vim-airline:
配置statusbar.