From eb061c6507c527723cffec3aca5b9556e9e2d5cf Mon Sep 17 00:00:00 2001 From: UEDA Naoaki Date: Mon, 29 Jul 2024 00:58:34 +0900 Subject: Modify lightline config to show the filepath --- _config/101-lightline.vim | 12 +++++++++++- _config/113-auto-touch-on-save.vim | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) 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() diff --git a/_config/113-auto-touch-on-save.vim b/_config/113-auto-touch-on-save.vim index 7505741..d1bdf9c 100644 --- a/_config/113-auto-touch-on-save.vim +++ b/_config/113-auto-touch-on-save.vim @@ -1,2 +1,4 @@ +UsePlugin 'auto-touch-on-save.vim' + let g:auto_touch_on_save_condition = 'podman machine list --format "{{ .Running }}" | grep -q true' let g:auto_touch_on_save_command = 'podman machine ssh -- touch' -- cgit v1.2.3-54-g00ecf