我有一个tabline函数,我从某个地方偷走/修改,但我希望文件名在它之前有一个星号,如果它自上次写入磁盘后被修改(即如果:up将执行一个动作).
例如,当我打开vim -p file * .txt时,这是我的tabline
file1.txt file2.txt file3.txt
然后在我更改file1.txt后不保存它:
*file1.txt file2.txt file3.txt
我的tabline函数:
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