I have a tab function that I stole / modified somewhere, but I would like the file name to have an asterisk in front of me if it has been changed since the last time it was written to disk (i.e. if: up would take action )
For example, this is my tab when I open the vim -p * .txt file
file1.txt file2.txt file3.txt
Then after modifying file1.txt and do not save it:
*file1.txt file2.txt file3.txt
My tab function:
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
source share