diff --git a/vim/settings/lightline.vim b/vim/settings/lightline.vim index a54ca791..892f5097 100644 --- a/vim/settings/lightline.vim +++ b/vim/settings/lightline.vim @@ -1,19 +1,40 @@ let g:lightline = { \ 'colorscheme': 'solarized', \ 'active': { - \ 'left': [ [ 'mode' ], + \ 'left': [ [ 'mode', 'paste' ], \ [ 'fugitive', 'readonly', 'filename', 'modified' ] ] \ }, - \ 'component': { - \ 'readonly': '%{&readonly?"⭤":""}', - \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' - \ }, - \ 'component_visible_condition': { - \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())' + \ 'component_function': { + \ 'fugitive': 'MyFugitive', + \ 'readonly': 'MyReadonly', + \ 'filename': 'MyFilename', \ }, \ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ } +function! MyReadonly() + if &filetype == "help" + return "" + elseif &readonly + return "⭤ " + else + return "" + endif +endfunction + +function! MyFugitive() + if exists("*fugitive#head") + let _ = fugitive#head() + return strlen(_) ? '⭠ '._ : '' + endif + return '' +endfunction + +function! MyFilename() + return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . + \ ('' != expand('%') ? expand('%') : '[NoName]') +endfunction + " Use status bar even with single buffer set laststatus=2