1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 13:10:03 +08:00
SpaceVim/autoload/SpaceVim/options.vim

38 lines
1.2 KiB
VimL
Raw Normal View History

"=============================================================================
" options.vim --- options function in SpaceVim
2022-02-03 17:24:51 +08:00
" Copyright (c) 2016-2022 Wang Shidong & Contributors
2022-03-27 13:38:54 +08:00
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:CMP = SpaceVim#api#import('vim#compatible')
2017-01-24 00:16:35 +08:00
function! SpaceVim#options#list() abort
2017-03-06 23:26:26 +08:00
let list = []
if has('patch-7.4.2010')
2017-03-06 23:26:26 +08:00
for var in getcompletion('g:spacevim_','var')
2018-07-28 15:25:12 +08:00
call add(list, ' ' . var[11:] . ' = ' . string(get(g:, var[2:] , '')))
2017-03-06 23:26:26 +08:00
endfor
else
redraw
for var in filter(map(split(s:CMP.execute('let g:'), "\n"), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
2018-07-28 15:25:12 +08:00
call add(list, ' ' . var[11:] . ' = ' . string(get(g:, var , '')))
2017-03-06 23:26:26 +08:00
endfor
endif
return list
2017-01-24 00:16:35 +08:00
endfunction
2017-03-07 23:31:51 +08:00
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
2017-03-06 23:26:26 +08:00
" vim:set et sw=2: