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