我有一个选项卡功能,是从某个地方偷/修改的,但如果文件自上次写入磁盘以来已经被修改(即如果:up将执行操作),我希望文件名前面有一个星号。例如,当我打开vim-p file *.txt时,这是我的选项卡线。
file1.txt file2.txt file3.txt
然后我修改了 file1.txt 文件,但没有保存:
*file1.txt file2.txt file3.txt
我的标签栏函数:
if exists("+showtabline")
function MyTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= ' %*'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
set stal=2
set tabline=%!MyTabLine()
endif