diff options
Diffstat (limited to '_config/101-lightline.vim')
-rw-r--r-- | _config/101-lightline.vim | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/_config/101-lightline.vim b/_config/101-lightline.vim index dcee2e2..4e8a8c3 100644 --- a/_config/101-lightline.vim +++ b/_config/101-lightline.vim @@ -17,7 +17,8 @@ let g:lightline = { \ 'linter_errors': 'error' \ }, \ 'component_function': { -\ 'gitbranch': 'FugitiveHead' +\ 'gitbranch': 'FugitiveHead', +\ 'filename': 'LightlineFilename' \ }, \ } @@ -37,6 +38,15 @@ function! LightlineLinterOK() abort return l:total == 0 ? 'OK' : '' endfunction +function! LightlineFilename() + let path = expand('%:p') + let root = trim(system('git rev-parse --show-toplevel 2>/dev/null')) + if v:shell_error == 0 && path[:len(root)-1] ==# root + return path[len(root)+1:] + endif + return expand('%') +endfunction + augroup LightLineOnLSP autocmd! autocmd User lsp_diagnostics_updated call lightline#update() |