mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-14 14:33:51 -05:00
try catch in lightline#link (in case so $MYVIMRC, related to #8)
This commit is contained in:
@@ -527,7 +527,7 @@ function! MyModified()
|
||||
endfunction
|
||||
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '⭤' : ''
|
||||
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
|
||||
function! MyFilename()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Version: 0.0
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/08/27 16:22:36.
|
||||
" Last Change: 2013/08/27 18:29:04.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
@@ -94,16 +94,21 @@ function! lightline#mode()
|
||||
endfunction
|
||||
|
||||
function! lightline#link()
|
||||
let mode = get(g:lightline._mode_, mode(), 'normal')
|
||||
for i in range(len(g:lightline.active.left))
|
||||
exec printf('hi link LightLineLeft_active_%d LightLineLeft_%s_%d', i, mode, i)
|
||||
exec printf('hi link LightLineLeft_active_%d_%d LightLineLeft_%s_%d_%d', i, i + 1, mode, i, i + 1)
|
||||
endfor
|
||||
exec printf('hi link LightLineMiddle_active LightLineMiddle_%s', mode)
|
||||
for i in range(len(g:lightline.active.right))
|
||||
exec printf('hi link LightLineRight_active_%d LightLineRight_%s_%d', i, mode, i)
|
||||
exec printf('hi link LightLineRight_active_%d_%d LightLineRight_%s_%d_%d', i, i + 1, mode, i, i + 1)
|
||||
endfor
|
||||
try
|
||||
let mode = get(g:lightline._mode_, mode(), 'normal')
|
||||
for i in range(len(g:lightline.active.left))
|
||||
exec printf('hi link LightLineLeft_active_%d LightLineLeft_%s_%d', i, mode, i)
|
||||
exec printf('hi link LightLineLeft_active_%d_%d LightLineLeft_%s_%d_%d', i, i + 1, mode, i, i + 1)
|
||||
endfor
|
||||
exec printf('hi link LightLineMiddle_active LightLineMiddle_%s', mode)
|
||||
for i in range(len(g:lightline.active.right))
|
||||
exec printf('hi link LightLineRight_active_%d LightLineRight_%s_%d', i, mode, i)
|
||||
exec printf('hi link LightLineRight_active_%d_%d LightLineRight_%s_%d_%d', i, i + 1, mode, i, i + 1)
|
||||
endfor
|
||||
catch
|
||||
let s:_ = 1
|
||||
call lightline#update()
|
||||
endtry
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Version: 0.0
|
||||
Author: itchyny (https://github.com/itchyny)
|
||||
License: MIT License
|
||||
Repository: https://github.com/itchyny/lightline.vim
|
||||
Last Change: 2013/08/27 16:19:02.
|
||||
Last Change: 2013/08/27 17:16:34.
|
||||
|
||||
CONTENTS *lightline-contents*
|
||||
|
||||
@@ -113,7 +113,7 @@ OPTIONS *lightline-option*
|
||||
\ },
|
||||
\ }
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help' && &ro ? 'RO' : ''
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
<
|
||||
g:lightline.colorscheme *g:lightline.colorscheme*
|
||||
@@ -275,7 +275,7 @@ In order to define your own component:
|
||||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||||
endfunction
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help' && &ro ? 'RO' : ''
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
function! MyModified()
|
||||
return &modifiable && &modified ? '+' : ''
|
||||
@@ -325,7 +325,7 @@ A nice example for non-patched font users.
|
||||
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help\|vimfiler' && &ro ? 'RO' : ''
|
||||
return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
function! MyFilename()
|
||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||
@@ -357,7 +357,7 @@ A nice example for |vim-powerline| font users:
|
||||
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help\|vimfiler' && &ro ? '⭤' : ''
|
||||
return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
function! MyFilename()
|
||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||
|
||||
Reference in New Issue
Block a user