Closed ixti closed 2 years ago
Found solution (inspired by your dotfiles' s:safe
function) :D
" file: ~/.vim/plugin.d/lightline.vim
function! lightline#gitbranch() abort
try
return gina#component#repo#branch()
catch
return ''
endtry
endfunction
let g:lightline =
\ {
\ 'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
\ ]
\ },
\ 'component': { 'lineinfo': ' %3l:%-2v' },
\ 'component_function': { 'gitbranch': 'lightline#safe_branch' },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
I use gina with lightline:
And it works perfect. But when I lack permissions to read
.git
(e.g. while using etckeeper for/etc
) it becomes a problem: