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