1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 02:10:05 +08:00

Improve statusline for SpaceVim

- support SpaceVimTabsManager
- support SpaceVimLayerManager
- support SpaceVimPlugManager
- Update TabsManager
This commit is contained in:
wsdjeg 2017-05-28 13:27:12 +08:00
parent 1474596303
commit 6ccaa42930
3 changed files with 16 additions and 9 deletions

View File

@ -4,12 +4,10 @@ let s:self._tree = {}
function! s:self._update() abort
let tabnr = tabpagenr('$')
if tabnr > 1
for i in range(1, tabnr)
let buffers = tabpagebuflist(i)
let self._tree[i] = buffers
endfor
endif
endfunction
function! s:self._jump(tabnr, bufid) abort

View File

@ -40,7 +40,7 @@ function! s:find_layers() abort
for layer in layers
if layer =~# pattern
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'))
let website = 'https://spacevim.org/layers/' . name
else
@ -49,7 +49,7 @@ function! s:find_layers() abort
if status == 'loaded'
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
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
endfor

View File

@ -174,6 +174,15 @@ function! SpaceVim#layers#core#statusline#get(...) abort
\ . '%#SpaceVim_statusline_b# tagbar %#SpaceVim_statusline_b_c#'
elseif &filetype ==# 'startify'
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
if a:0 > 0
return s:active()
@ -240,7 +249,7 @@ endfunction
function! SpaceVim#layers#core#statusline#init() abort
augroup status
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()
augroup END
endfunction