1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 23:50:05 +08:00
SpaceVim/autoload/SpaceVim/options.vim
2018-07-28 15:25:12 +08:00

38 lines
1.2 KiB
VimL

"=============================================================================
" options.vim --- options function in SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:CPT = SpaceVim#api#import('vim#compatible')
function! SpaceVim#options#list() abort
let list = []
if has('patch-7.4.2010')
for var in getcompletion('g:spacevim_','var')
call add(list, ' ' . var[11:] . ' = ' . string(get(g:, var[2:] , '')))
endfor
else
redraw
for var in filter(map(split(s:CPT.execute('let g:'), "\n"), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
call add(list, ' ' . var[11:] . ' = ' . string(get(g:, var , '')))
endfor
endif
return list
endfunction
function! SpaceVim#options#set(argv, ...) abort
if a:0 > 0
if exists('g:spacevim_' . a:argv)
exe 'let g:spacevim_' . a:argv . '=' . a:1
endif
else
if exists('g:spacevim_' . a:argv)
exe 'echo string(g:spacevim_' . a:argv . ')'
endif
endif
endfunction
" vim:set et sw=2: