mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:40:05 +08:00
Improve statusline for SpaceVim
- support SpaceVimTabsManager - support SpaceVimLayerManager - support SpaceVimPlugManager - Update TabsManager
This commit is contained in:
parent
1474596303
commit
6ccaa42930
@ -4,12 +4,10 @@ let s:self._tree = {}
|
|||||||
|
|
||||||
function! s:self._update() abort
|
function! s:self._update() abort
|
||||||
let tabnr = tabpagenr('$')
|
let tabnr = tabpagenr('$')
|
||||||
if tabnr > 1
|
|
||||||
for i in range(1, tabnr)
|
for i in range(1, tabnr)
|
||||||
let buffers = tabpagebuflist(i)
|
let buffers = tabpagebuflist(i)
|
||||||
let self._tree[i] = buffers
|
let self._tree[i] = buffers
|
||||||
endfor
|
endfor
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:self._jump(tabnr, bufid) abort
|
function! s:self._jump(tabnr, bufid) abort
|
||||||
|
@ -40,7 +40,7 @@ function! s:find_layers() abort
|
|||||||
for layer in layers
|
for layer in layers
|
||||||
if layer =~# pattern
|
if layer =~# pattern
|
||||||
let name = layer[matchend(layer, pattern):-5]
|
let name = layer[matchend(layer, pattern):-5]
|
||||||
let status = index(g:spacevim_plugin_groups, substitute(name, '/', '#','g')) ? 'loaded' : 'not loaded'
|
let status = (index(g:spacevim_plugin_groups, substitute(name, '/', '#','g')) != -1) ? 'loaded' : 'not loaded'
|
||||||
if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md'))
|
if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md'))
|
||||||
let website = 'https://spacevim.org/layers/' . name
|
let website = 'https://spacevim.org/layers/' . name
|
||||||
else
|
else
|
||||||
@ -49,7 +49,7 @@ function! s:find_layers() abort
|
|||||||
if status == 'loaded'
|
if status == 'loaded'
|
||||||
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
|
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
|
||||||
else
|
else
|
||||||
call add(rst, '- ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
|
call add(rst, '- ' . name . ':' . repeat(' ', 21 - len(name)) . status . repeat(' ', 10) . website)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -174,6 +174,15 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
|||||||
\ . '%#SpaceVim_statusline_b# tagbar %#SpaceVim_statusline_b_c#'
|
\ . '%#SpaceVim_statusline_b# tagbar %#SpaceVim_statusline_b_c#'
|
||||||
elseif &filetype ==# 'startify'
|
elseif &filetype ==# 'startify'
|
||||||
call fugitive#detect(getcwd())
|
call fugitive#detect(getcwd())
|
||||||
|
elseif &filetype ==# 'SpaceVimLayerManager'
|
||||||
|
return '%#SpaceVim_statusline_a#' . s:winnr() . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||||
|
\ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#'
|
||||||
|
elseif &filetype ==# 'SpaceVimPlugManager'
|
||||||
|
return '%#SpaceVim_statusline_a#' . s:winnr() . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||||
|
\ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#'
|
||||||
|
elseif &filetype ==# 'SpaceVimTabsManager'
|
||||||
|
return '%#SpaceVim_statusline_a#' . s:winnr() . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||||
|
\ . '%#SpaceVim_statusline_b# TabsManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#'
|
||||||
endif
|
endif
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
return s:active()
|
return s:active()
|
||||||
@ -240,7 +249,7 @@ endfunction
|
|||||||
function! SpaceVim#layers#core#statusline#init() abort
|
function! SpaceVim#layers#core#statusline#init() abort
|
||||||
augroup status
|
augroup status
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWinEnter,WinEnter * let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
autocmd BufWinEnter,WinEnter,FileType * let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||||
autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get()
|
autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get()
|
||||||
augroup END
|
augroup END
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user