From 743232f74a1cb388d0c109e7b696272ceac4f2bb Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 22 Mar 2017 00:03:26 +0800 Subject: [PATCH] Add SPVersion command --- autoload/SpaceVim/commands.vim | 123 +++++++++++++++++++++++++++++++++ doc/SpaceVim.txt | 5 ++ 2 files changed, 128 insertions(+) diff --git a/autoload/SpaceVim/commands.vim b/autoload/SpaceVim/commands.vim index 876d29fb4..167b32438 100644 --- a/autoload/SpaceVim/commands.vim +++ b/autoload/SpaceVim/commands.vim @@ -4,6 +4,11 @@ function! SpaceVim#commands#load() abort " of layer names. command! -nargs=+ SPLayer call SpaceVim#layers#load() "" + " Print the version of SpaceVim. The following lines contain information + " about which features were enabled. When there is a preceding '+', the + " feature is included, when there is a '-' it is excluded. + command! -nargs=0 SPVersion call SpaceVim#commands#version() + "" " Set or check SpaceVim option. {opt} should be the option name of " spacevim, This command will use [value] as the value of option name. command! -nargs=+ SPSet call SpaceVim#options#set() @@ -42,4 +47,122 @@ function! SpaceVim#commands#config(...) abort endfunction +function! SpaceVim#commands#version() abort + echo 'SpaceVim ' . g:spacevim_version . '-' . "\n" . + \ "\n" . + \ 'Optional features included (+) or not (-):' . "\n" + \ s:check_features([ + \ 'tui', + \ 'jemalloc', + \ 'acl', + \ 'arabic', + \ 'autocmd', + \ 'browse', + \ 'byte_offset', + \ 'cindent', + \ 'clientserver', + \ 'clipboard', + \ 'cmdline_compl', + \ 'cmdline_hist', + \ 'cmdline_info', + \ 'comments', + \ 'conceal', + \ 'cscope', + \ 'cursorbind', + \ 'cursorshape', + \ 'debug', + \ 'dialog_gui', + \ 'dialog_con', + \ 'dialog_con_gui', + \ 'digraphs', + \ 'eval', + \ 'ex_extra', + \ 'extra_search', + \ 'farsi', + \ 'file_in_path', + \ 'find_in_path', + \ 'folding', + \ 'gettext', + \ 'iconv', + \ 'iconv/dyn', + \ 'insert_expand', + \ 'jumplist', + \ 'keymap', + \ 'langmap', + \ 'libcall', + \ 'linebreak', + \ 'lispindent', + \ 'listcmds', + \ 'localmap', + \ 'menu', + \ 'mksession', + \ 'modify_fname', + \ 'mouse', + \ 'mouseshape', + \ 'multi_byte', + \ 'multi_byte_ime', + \ 'multi_lang', + \ 'path_extra', + \ 'persistent_undo', + \ 'postscript', + \ 'printer', + \ 'profile', + \ 'python', + \ 'python3', + \ 'quickfix', + \ 'reltime', + \ 'rightleft', + \ 'scrollbind', + \ 'shada', + \ 'signs', + \ 'smartindent', + \ 'startuptime', + \ 'statusline', + \ 'syntax', + \ 'tablineat', + \ 'tag_binary', + \ 'tag_old_static', + \ 'tag_any_white', + \ 'termguicolors', + \ 'terminfo', + \ 'termresponse', + \ 'textobjects', + \ 'tgetent', + \ 'timers', + \ 'title', + \ 'toolbar', + \ 'user_commands', + \ 'vertsplit', + \ 'virtualedit', + \ 'visual', + \ 'visualextra', + \ 'vreplace', + \ 'wildignore', + \ 'wildmenu', + \ 'windows', + \ 'writebackup', + \ 'xim', + \ 'xfontset', + \ 'xpm', + \ 'xpm_w32', + \ ]) +endfunction + +function! s:check_features(features) abort + let flist = map(a:features, "(has(v:val) ? '+' : '-') . v:val") + let rst = ' ' + let id = 1 + for f in flist + let rst .= f . repeat(' ', 20 - len(f)) + if id == 3 + let rst .= "\n " + let id = 1 + else + let id += 1 + endif + endfor + return substitute(rst, '\n*\s*$', '', 'g') +endfunction + + " vim:set et sw=2 cc=80: diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index f5446a08c..babcf218b 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -276,6 +276,11 @@ COMMANDS *SpaceVim-commands* Load exist layer, {layers} can be a string of a layer name, or a list of layer names. +:SPVersion *:SPVersion* + Print the version of SpaceVim. The following lines contain information + about which features were enabled. When there is a preceding '+', the + feature is included, when there is a '-' it is excluded. + :SPSet {opt} [value] *:SPSet* Set or check SpaceVim option. {opt} should be the option name of spacevim, This command will use [value] as the value of option name.