From 99cedb6c94d42fe3055256822aab4c526a4e59b2 Mon Sep 17 00:00:00 2001 From: jdhao Date: Sun, 8 Nov 2020 20:02:30 +0800 Subject: [PATCH] Do no show file time for not listed buffers. --- core/options.vim | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/core/options.vim b/core/options.vim index 7722d0f..1e918d6 100644 --- a/core/options.vim +++ b/core/options.vim @@ -104,11 +104,20 @@ set autowrite " lastmod time is drawn from https://stackoverflow.com/q/8426736/6064933 set title set titlestring= -if g:is_linux - set titlestring+=%(%{hostname()}\ \ %) -endif -set titlestring+=%(%{expand('%:p:~')}\ \ %) -set titlestring+=%{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))} +set titlestring=%{Get_titlestr()} + +function! Get_titlestr() abort + let l:title_str = '' + if g:is_linux + let l:title_str = hostname() . ' ' + endif + let l:title_str = l:title_str . expand('%:p:~') . ' ' + if &buflisted + let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M',getftime(expand('%'))) + endif + + return l:title_str +endfunction " Persistent undo even after you close a file and re-open it set undofile