From 0cc33349c39108b5a7c15adb518cc87f761d2f7f Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Thu, 10 Jun 2021 14:16:30 +0200 Subject: [PATCH] feat(vim): show git branch and relative filepath in status line --- .config/nvim/init.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ee6cdc8..693c19c 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -264,6 +264,28 @@ nnoremap :NERDTreeMirror:NERDTreeFind " Rainbow Brackets let g:rainbow_active = 1 +" Lightline +let g:lightline = { + \ 'colorscheme': 'wombat', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ], + \ }, + \ 'component_function': { + \ 'gitbranch': 'FugitiveHead', + \ 'filename': 'LightlineFilename', + \ }, + \ } + +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 + " ----------------------- " Remaps " -----------------------