From 342aee140cdb0c9d9754ce5132d939a3131a7cef Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 31 Jan 2017 21:11:31 +0800 Subject: [PATCH] Add s:execute function thanks to tweekmonster --- autoload/SpaceVim/options.vim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/options.vim b/autoload/SpaceVim/options.vim index 32afac980..2c04827cc 100644 --- a/autoload/SpaceVim/options.vim +++ b/autoload/SpaceVim/options.vim @@ -1,13 +1,25 @@ function! SpaceVim#options#list() abort let list = [] - if has('patch-7.4.2010') + if has('patch-7.4.2010') && 0 for var in getcompletion('g:spacevim_','var') call add(list, var . ' = ' . string(get(g:, var[2:] , ''))) endfor else - for var in filter(map(split(execute('let g:'), "\n"), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'") + redraw + for var in filter(map(s:execute('let g:'), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'") call add(list,'g:' . var . ' = ' . string(get(g:, var , ''))) endfor endif return list endfunction + +function! s:execute(cmd) abort + if exists('*execute') + return split(execute(a:cmd), "\n") + endif + + redir => output + execute a:cmd + redir END + return split(output, "\n") +endfunction