mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-14 14:33:51 -05:00
change events for updating the statusline, from BufWinEnter,FileType to BufEnter (close #352)
- fix the active statusline after updating the quickfix/location list - use g:qf_disable_statusline to disable the statusline of the default ftplugin - for before Vim 8.1.1715, keep using FileType event to overwrite the statusline of the quickfix window
This commit is contained in:
@@ -18,6 +18,7 @@ cache:
|
|||||||
- $HOME/vim-$VIM_VERSION
|
- $HOME/vim-$VIM_VERSION
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
- VIM_VERSION=8.1.1775
|
||||||
- VIM_VERSION=8.1.1700
|
- VIM_VERSION=8.1.1700
|
||||||
- VIM_VERSION=8.1.0000
|
- VIM_VERSION=8.1.0000
|
||||||
- VIM_VERSION=8.0.0000
|
- VIM_VERSION=8.0.0000
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Filename: autoload/lightline.vim
|
" Filename: autoload/lightline.vim
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2019/07/20 12:00:00.
|
" Last Change: 2019/07/30 12:00:00.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -46,7 +46,10 @@ function! lightline#enable() abort
|
|||||||
call lightline#update()
|
call lightline#update()
|
||||||
augroup lightline
|
augroup lightline
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
|
autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update()
|
||||||
|
if !has('patch-8.1.1715')
|
||||||
|
autocmd FileType qf call lightline#update()
|
||||||
|
endif
|
||||||
autocmd SessionLoadPost * call lightline#highlight()
|
autocmd SessionLoadPost * call lightline#highlight()
|
||||||
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
|
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
|
||||||
\ | call lightline#update() | call lightline#highlight() | endif
|
\ | call lightline#update() | call lightline#highlight() | endif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Filename: plugin/lightline.vim
|
" Filename: plugin/lightline.vim
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2018/06/22 08:49:00.
|
" Last Change: 2019/07/30 12:00:00.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
if exists('g:loaded_lightline') || v:version < 700
|
if exists('g:loaded_lightline') || v:version < 700
|
||||||
@@ -15,12 +15,20 @@ set cpo&vim
|
|||||||
|
|
||||||
augroup lightline
|
augroup lightline
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
|
autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update()
|
||||||
|
if !has('patch-8.1.1715')
|
||||||
|
autocmd FileType qf call lightline#update()
|
||||||
|
endif
|
||||||
autocmd SessionLoadPost * call lightline#highlight()
|
autocmd SessionLoadPost * call lightline#highlight()
|
||||||
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
|
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
|
||||||
\ | call lightline#update() | call lightline#highlight() | endif
|
\ | call lightline#update() | call lightline#highlight() | endif
|
||||||
autocmd CursorMoved,BufUnload * call lightline#update_once()
|
autocmd CursorMoved,BufUnload * call lightline#update_once()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
" This quickfix option was introduced at Vim 85850f3a5ef9, which is the commit
|
||||||
|
" just before 8.1.1715. Before this patch, autocmd FileType is required to
|
||||||
|
" overwrite the statusline of the quickfix and location windows.
|
||||||
|
let g:qf_disable_statusline = 1
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|||||||
@@ -18,3 +18,5 @@ endfunction
|
|||||||
function! SID(name) abort
|
function! SID(name) abort
|
||||||
return function(printf("\<SNR>%d_%s", s:sid('autoload/lightline.vim'), a:name))
|
return function(printf("\<SNR>%d_%s", s:sid('autoload/lightline.vim'), a:name))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
filetype plugin on
|
||||||
|
|||||||
25
test/quickfix.vim
Normal file
25
test/quickfix.vim
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
let s:suite = themis#suite('quickfix')
|
||||||
|
let s:assert = themis#helper('assert')
|
||||||
|
|
||||||
|
function! s:suite.before_each()
|
||||||
|
let g:lightline = {}
|
||||||
|
call lightline#init()
|
||||||
|
tabnew
|
||||||
|
tabonly
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:suite.quickfix_statusline()
|
||||||
|
call setloclist(winnr(), [])
|
||||||
|
lopen
|
||||||
|
wincmd p
|
||||||
|
call setloclist(winnr(), [])
|
||||||
|
for n in range(1, winnr('$'))
|
||||||
|
let statusline = getwinvar(n, '&statusline')
|
||||||
|
call s:assert.match(statusline, 'lightline')
|
||||||
|
if has('patch-8.1.1715')
|
||||||
|
call s:assert.match(statusline, n == 1 ? '_active_' : '_inactive_')
|
||||||
|
else
|
||||||
|
call s:assert.match(statusline, n != 1 ? '_active_' : '_inactive_')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
Reference in New Issue
Block a user