Add full path in status line for vim

This commit is contained in:
2020-08-31 11:20:46 +02:00
parent 2ef14f2c78
commit 543d7ad93d
+11
View File
@@ -175,6 +175,16 @@ command! -nargs=1 RandomString :normal a<c-r>=RandomString(<f-args>)<cr>
command! InsertTime :normal a<c-r>=strftime('%F %H:%M:%S.0 %z')<cr> command! InsertTime :normal a<c-r>=strftime('%F %H:%M:%S.0 %z')<cr>
""colorscheme desert ""colorscheme desert
"" Status line full path for filename
function LightlineFilename()
let root = fnamemodify(get(b:, 'git_dir'), ':h')
let path = expand('%:p')
if path[:len(root)+1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
" Bootstrap autoreload " Bootstrap autoreload
if empty(glob('~/.vim/autoload/plug.vim')) if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
@@ -235,6 +245,7 @@ let g:lightline = {
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'gitbranch': 'fugitive#head', \ 'gitbranch': 'fugitive#head',
\ 'filename': 'LightlineFilename',
\ }, \ },
\ 'component_expand': { \ 'component_expand': {
\ 'gitdiff': 'lightline#gitdiff#get', \ 'gitdiff': 'lightline#gitdiff#get',