~garritfra/dotfiles

0cc33349c39108b5a7c15adb518cc87f761d2f7f — Garrit Franke 5 months ago ef9f275
feat(vim): show git branch and relative filepath in status line
1 files changed, 22 insertions(+), 0 deletions(-)

M .config/nvim/init.vim
M .config/nvim/init.vim => .config/nvim/init.vim +22 -0
@@ 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
" -----------------------