1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

refactor: move titlestring method to autoload dir

This commit is contained in:
jdhao 2020-11-08 22:20:40 +08:00
parent 99cedb6c94
commit ba3254bd65
2 changed files with 15 additions and 14 deletions

View File

@ -131,3 +131,17 @@ function! utils#MoveSelection(direction) abort
normal gv
endif
endfunction
function! utils#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

View File

@ -104,20 +104,7 @@ set autowrite
" lastmod time is drawn from https://stackoverflow.com/q/8426736/6064933
set title
set titlestring=
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
set titlestring=%{utils#Get_titlestr()}
" Persistent undo even after you close a file and re-open it
set undofile