From 35c32f386a3c8e812b5cef05463a9cc11c5afc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bygd=C3=A9n?= Date: Tue, 11 Nov 2014 14:53:28 +0100 Subject: [PATCH] Modified setings of lightline to match the README in the lightline project Added indication of paste mode, added functions instead of code in call of components, added git branch glyph, added path to file being edited --- vim/settings/lightline.vim | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) 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