当前运行:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 1 2012 18:08:47)
MacOS X (unix) version
Included patches: 1-646
Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>
我的 .gvimrc 中有以下代码,它应该将所有缓冲区的列表显示为工具提示。但是,它仅显示在当前选项卡(拆分窗口)中可见打开的缓冲区列表。该:buffers
命令正确列出了所有缓冲区。
我是否误解了这段代码的用途(我是 Vim 脚本的新手;这段代码是从开源配置中借来的)?
"show tooltips on tabs
set guitabtooltip=%{GuiTabToolTip()}
" set up tab tooltips with every buffer name
function! GuiTabToolTip()
let tip = ''
let bufnrlist = tabpagebuflist(v:lnum)
for bufnr in bufnrlist
" separate buffer entries
if tip!=''
let tip .= ' | '
endif
" Add name of buffer
let name=bufname(bufnr)
if name == ''
" give a name to no name documents
if getbufvar(bufnr,'&buftype')=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
endif
let tip.=name
" add modified/modifiable flags
if getbufvar(bufnr, "&modified")
let tip .= ' [+]'
endif
if getbufvar(bufnr, "&modifiable")==0
let tip .= ' [-]'
endif
endfor
return tip
endfunction