mirror of
https://github.com/amix/vimrc
synced 2025-07-07 00:15:00 +08:00
Updated vim plugins
This commit is contained in:
@ -2,16 +2,17 @@
|
||||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2018/09/17 12:00:00.
|
||||
" Last Change: 2018/11/24 12:00:00.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:_ = 1
|
||||
let s:_ = 1 " 1: uninitialized, 2: disabled
|
||||
|
||||
function! lightline#update() abort
|
||||
if s:_
|
||||
if s:_ == 2 | return | endif
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
endif
|
||||
@ -40,11 +41,8 @@ function! lightline#update_disable() abort
|
||||
endfunction
|
||||
|
||||
function! lightline#enable() abort
|
||||
call lightline#colorscheme()
|
||||
let s:_ = 1
|
||||
call lightline#update()
|
||||
if s:lightline.enable.tabline
|
||||
set tabline=%!lightline#tabline()
|
||||
endif
|
||||
augroup lightline
|
||||
autocmd!
|
||||
autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
|
||||
@ -74,6 +72,7 @@ function! lightline#disable() abort
|
||||
autocmd!
|
||||
autocmd WinEnter * call lightline#update_disable()
|
||||
augroup END
|
||||
let s:_ = 2
|
||||
endfunction
|
||||
|
||||
function! lightline#toggle() abort
|
||||
|
@ -452,13 +452,9 @@ In order to change the syntastic component more outstanding, you have to use
|
||||
\ 'syntastic': 'error',
|
||||
\ }
|
||||
\ }
|
||||
let g:syntastic_mode_map = { 'mode': 'passive' }
|
||||
augroup AutoSyntastic
|
||||
autocmd!
|
||||
autocmd BufWritePost *.c,*.cpp call s:syntastic()
|
||||
augroup END
|
||||
function! s:syntastic()
|
||||
SyntasticCheck
|
||||
" Syntastic can call a post-check hook, let's update lightline there
|
||||
" For more information: :help syntastic-loclist-callback
|
||||
function! SyntasticCheckHook(errors)
|
||||
call lightline#update()
|
||||
endfunction
|
||||
<
|
||||
@ -908,12 +904,9 @@ For users who uses lots of plugins:
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
augroup AutoSyntastic
|
||||
autocmd!
|
||||
autocmd BufWritePost *.c,*.cpp call s:syntastic()
|
||||
augroup END
|
||||
function! s:syntastic()
|
||||
SyntasticCheck
|
||||
" Syntastic can call a post-check hook, let's update lightline there
|
||||
" For more information: :help syntastic-loclist-callback
|
||||
function! SyntasticCheckHook(errors)
|
||||
call lightline#update()
|
||||
endfunction
|
||||
|
||||
|
@ -11,6 +11,7 @@ endfunction
|
||||
function! s:suite.default()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
@ -18,10 +19,15 @@ function! s:suite.disable_enable()
|
||||
call lightline#disable()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#update()
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#enable()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
@ -29,9 +35,11 @@ function! s:suite.toggle()
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user