From 6ccaa42930db245ccba0ad6b97e6b53ff1254f74 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 28 May 2017 13:27:12 +0800 Subject: [PATCH] Improve statusline for SpaceVim - support SpaceVimTabsManager - support SpaceVimLayerManager - support SpaceVimPlugManager - Update TabsManager --- autoload/SpaceVim/api/vim/tab.vim | 10 ++++------ autoload/SpaceVim/layers.vim | 4 ++-- autoload/SpaceVim/layers/core/statusline.vim | 11 ++++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/autoload/SpaceVim/api/vim/tab.vim b/autoload/SpaceVim/api/vim/tab.vim index a40745ca9..61b44dc59 100644 --- a/autoload/SpaceVim/api/vim/tab.vim +++ b/autoload/SpaceVim/api/vim/tab.vim @@ -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 + for i in range(1, tabnr) + let buffers = tabpagebuflist(i) + let self._tree[i] = buffers + endfor endfunction function! s:self._jump(tabnr, bufid) abort diff --git a/autoload/SpaceVim/layers.vim b/autoload/SpaceVim/layers.vim index c204d038c..ef85e5cd9 100644 --- a/autoload/SpaceVim/layers.vim +++ b/autoload/SpaceVim/layers.vim @@ -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 diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index c437f35ea..cb987d6ec 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -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