Browse Source

feat(vim): show git branch and relative filepath in status line

refactor/nvim-lua
Garrit Franke 3 years ago
parent
commit
0cc33349c3
Signed by: garrit
GPG Key ID: 65586C4DDA55EA2C
  1. 22
      .config/nvim/init.vim

22
.config/nvim/init.vim

@ -264,6 +264,28 @@ nnoremap <C-n> :NERDTreeMirror<CR>:NERDTreeFind<CR>
" 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
" -----------------------

Loading…
Cancel
Save