diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim index 700d6e8fc..309597f59 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -1,3 +1,11 @@ +"============================================================================= +" Achievements.vim --- Script for generate achievements +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + function! s:generate_content() abort let content = ['## Achievements', ''] let content += s:issues_ac() @@ -30,7 +38,7 @@ function! s:issues_ac() abort break endif endfor - if line[-1] != '' + if line[-1] !=# '' let line += [''] endif return line @@ -61,13 +69,13 @@ function! s:stargazers_ac() abort endif endif endfor - if line[-1] != '' + if line[-1] !=# '' let line += [''] endif return line endfunction -function! SpaceVim#dev#Achievements#update() +function! SpaceVim#dev#Achievements#update() abort let [start, end] = s:find_position() if start != 0 && end != 0 if end - start > 1 diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/z.vim b/.SpaceVim.d/autoload/SpaceVim/dev/z.vim index 17fc44900..3fae9f82f 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/z.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/z.vim @@ -1,8 +1,15 @@ -function! SpaceVim#dev#z#updatedoc() +"============================================================================= +" z.vim --- Script for generate doc of z key bindings +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= +function! SpaceVim#dev#z#updatedoc() abort let keys = keys(g:_spacevim_mappings_z) let lines = [] for key in keys - if key == '`' + if key ==# '`' let line = '`` z' . key . ' `` | ' . g:_spacevim_mappings_z[key][1] else let line = '`z' . key . '` | ' . g:_spacevim_mappings_z[key][1] diff --git a/.SpaceVim.d/init.vim b/.SpaceVim.d/init.vim index 0ffb12649..d8afb4117 100644 --- a/.SpaceVim.d/init.vim +++ b/.SpaceVim.d/init.vim @@ -1,3 +1,11 @@ +"============================================================================= +" init.vim --- local config for SpaceVim development +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + let g:spacevim_force_global_config = 1 call SpaceVim#custom#SPC('nnoremap', ['a', 'r'], 'call SpaceVim#dev#releases#open()', 'Release SpaceVim', 1) call SpaceVim#custom#SPC('nnoremap', ['a', 'w'], 'call SpaceVim#dev#website#open()', 'Open SpaceVim local website', 1) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index c52af9690..92db6244a 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -349,7 +349,6 @@ let g:spacevim_auto_disable_touchpad = 1 " |SpaceVim#logger#setLevel()| let g:spacevim_debug_level = 1 let g:spacevim_hiddenfileinfo = 1 -let g:spacevim_plugin_groups_exclude = [] let g:spacevim_gitcommit_pr_icon = '' let g:spacevim_gitcommit_issue_icon = '' "" @@ -382,12 +381,6 @@ let g:spacevim_enable_tabline_filetype_icon = 0 " Enable/Disable os fileformat icon. default is 0. let g:spacevim_enable_os_fileformat_icon = 0 "" -" Plugin groups to be loaded. -" > -" let g:spacevim_plugin_groups = ['core', 'lang'] -" < -let g:spacevim_plugin_groups = [] -"" " Set the github username, It will be used for getting your starred repos, and " fuzzy find the repo you want. let g:spacevim_github_username = '' @@ -636,25 +629,15 @@ function! SpaceVim#end() abort let g:leaderGuide_map = {} call SpaceVim#mapping#guide#register_prefix_descriptions('', 'g:leaderGuide_map') endif - if g:spacevim_simple_mode - let g:spacevim_plugin_groups = ['core'] - else - for s:group in g:spacevim_plugin_groups_exclude - let s:i = index(g:spacevim_plugin_groups, s:group) - if s:i != -1 - call remove(g:spacevim_plugin_groups, s:i) - endif - endfor - if g:spacevim_vim_help_language ==# 'cn' - call add(g:spacevim_plugin_groups, 'chinese') - elseif g:spacevim_vim_help_language ==# 'ja' - call add(g:spacevim_plugin_groups, 'japanese') - endif - if g:spacevim_use_colorscheme==1 - call add(g:spacevim_plugin_groups, 'colorscheme') - endif - + if g:spacevim_vim_help_language ==# 'cn' + call SpaceVim#layers#load('chinese') + elseif g:spacevim_vim_help_language ==# 'ja' + call SpaceVim#layers#load('japanese') endif + if g:spacevim_use_colorscheme==1 + call SpaceVim#layers#load('colorscheme') + endif + "" " generate tags for SpaceVim let help = fnamemodify(g:_spacevim_root_dir, ':p:h:h') . '/doc' @@ -670,7 +653,7 @@ function! SpaceVim#end() abort silent exec 'lan ' . g:spacevim_language endif - if index(g:spacevim_plugin_groups, 'core#statusline') != -1 + if SpaceVim#layers#isLoaded('core#statusline') call SpaceVim#layers#core#statusline#init() endif diff --git a/autoload/SpaceVim/default.vim b/autoload/SpaceVim/default.vim index ae06d838e..2b7e910a0 100644 --- a/autoload/SpaceVim/default.vim +++ b/autoload/SpaceVim/default.vim @@ -129,29 +129,20 @@ endfunction "}}} function! SpaceVim#default#layers() abort - call SpaceVim#layers#load('autocomplete') call SpaceVim#layers#load('checkers') call SpaceVim#layers#load('format') call SpaceVim#layers#load('edit') + call SpaceVim#layers#load('tools') call SpaceVim#layers#load('ui') - call add(g:spacevim_plugin_groups, 'ui') - call add(g:spacevim_plugin_groups, 'tools') - call add(g:spacevim_plugin_groups, 'git') - call add(g:spacevim_plugin_groups, 'VersionControl') - - call add(g:spacevim_plugin_groups, 'core') + call SpaceVim#layers#load('core') call SpaceVim#layers#load('core#banner') call SpaceVim#layers#load('core#statusline') call SpaceVim#layers#load('core#tabline') - call add(g:spacevim_plugin_groups, 'default') - call add(g:spacevim_plugin_groups, 'unite') - call add(g:spacevim_plugin_groups, 'github') if has('python3') - call add(g:spacevim_plugin_groups, 'denite') - elseif has('python') + call SpaceVim#layers#load('denite') else - call add(g:spacevim_plugin_groups, 'ctrlp') + call SpaceVim#layers#load('unite') endif endfunction diff --git a/autoload/SpaceVim/layers.vim b/autoload/SpaceVim/layers.vim index c27b1c11a..7c82d6cdf 100644 --- a/autoload/SpaceVim/layers.vim +++ b/autoload/SpaceVim/layers.vim @@ -10,16 +10,17 @@ " @section Layers, layers " SpaceVim support such layers: +let s:enabled_layers = [] "" " Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers). " the second argv is the layer variable. function! SpaceVim#layers#load(layer, ...) abort - if a:layer == '-l' + if a:layer ==# '-l' call s:list_layers() endif - if index(g:spacevim_plugin_groups, a:layer) == -1 - call add(g:spacevim_plugin_groups, a:layer) + if index(s:enabled_layers, a:layer) == -1 + call add(s:enabled_layers, a:layer) endif if a:0 == 1 && type(a:1) == 4 try @@ -35,9 +36,9 @@ function! SpaceVim#layers#load(layer, ...) abort endfunction function! SpaceVim#layers#disable(layer) abort - let index = index(g:spacevim_plugin_groups, a:layer) + let index = index(s:enabled_layers, a:layer) if index != -1 - call remove(g:spacevim_plugin_groups, index) + call remove(s:enabled_layers, index) endif endfunction @@ -62,7 +63,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')) != -1) ? 'loaded' : 'not loaded' + let status = (index(s:enabled_layers, substitute(name, '/', '#','g')) != -1) ? 'loaded' : 'not loaded' if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md')) let website = 'https://spacevim.org/layers/' . name else @@ -78,6 +79,14 @@ function! s:find_layers() abort return rst endfunction +function! SpaceVim#layers#get() abort + return s:enabled_layers +endfunction + +function! SpaceVim#layers#isLoaded(layer) abort + return index(s:enabled_layers, a:layer) != -1 +endfunction + " vim:set et sw=2: diff --git a/autoload/SpaceVim/layers/chinese.vim b/autoload/SpaceVim/layers/chinese.vim index 487a81b2f..35a92ef85 100644 --- a/autoload/SpaceVim/layers/chinese.vim +++ b/autoload/SpaceVim/layers/chinese.vim @@ -11,7 +11,7 @@ function! SpaceVim#layers#chinese#plugins() abort let plugins = [ \ ['yianwillis/vimcdoc', {'merged' : 0}], \ ] - if index(g:spacevim_plugin_groups, 'ctrlp') != -1 + if SpaceVim#layers#isLoaded('ctrlp') call add(plugins, [['vimcn/ctrlp.cnx', {'merged' : 0}]]) endif return plugins diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 37977c415..059261b82 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -7,10 +7,17 @@ "============================================================================= function! SpaceVim#layers#core#plugins() abort - return [ - \ ['Shougo/vimproc.vim', {'build' : ['make']}], - \ ['benizi/vim-automkdir'], - \ ] + let plugins = [] + if g:spacevim_filemanager ==# 'nerdtree' + call add(plugins, ['scrooloose/nerdtree', { 'on_cmd' : 'NERDTreeToggle', + \ 'loadconf' : 1}]) + elseif g:spacevim_filemanager ==# 'vimfiler' + call add(plugins, ['Shougo/vimfiler.vim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : ['VimFiler', 'VimFilerBufferDir']}]) + call add(plugins, ['Shougo/unite.vim',{ 'merged' : 0 , 'loadconf' : 1}]) + call add(plugins, ['Shougo/vimproc.vim', {'build' : ['make']}]) + endif + call add(plugins, ['benizi/vim-automkdir']) + return plugins endfunction let s:filename = expand(':~') @@ -227,7 +234,7 @@ function! SpaceVim#layers#core#config() abort call SpaceVim#mapping#space#def('nnoremap', ['q', 'r'], '', 'restart-vim-resume-layouts(TODO)', 1) call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1) call SpaceVim#mapping#gd#add('HelpDescribe', function('s:gotodef')) - + endfunction function! s:gotodef() abort diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index bde744f4e..156b8cadc 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -75,7 +75,7 @@ let s:loaded_sections_l = g:spacevim_statusline_left_sections let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:i_separators['arrow']) -if index(g:spacevim_plugin_groups, 'checkers') != -1 +if SpaceVim#layers#isLoaded('checkers') call add(s:loaded_modes, 'syntax-checking') endif if &cc ==# '80' diff --git a/autoload/SpaceVim/layers/denite.vim b/autoload/SpaceVim/layers/denite.vim index 50c03c004..511d91162 100644 --- a/autoload/SpaceVim/layers/denite.vim +++ b/autoload/SpaceVim/layers/denite.vim @@ -15,6 +15,7 @@ endfunction function! SpaceVim#layers#denite#config() abort call SpaceVim#mapping#space#def('nnoremap', ['j', 'i'], 'Denite outline', 'jump to a definition in buffer', 1) + nnoremap :Denite file_rec endfunction " vim:set et sw=2 cc=80: diff --git a/autoload/SpaceVim/layers/lang/c.vim b/autoload/SpaceVim/layers/lang/c.vim index e38eac0ce..81561c173 100644 --- a/autoload/SpaceVim/layers/lang/c.vim +++ b/autoload/SpaceVim/layers/lang/c.vim @@ -97,6 +97,8 @@ function! SpaceVim#layers#lang#c#config() abort endif let g:chromatica#enable_at_startup=1 call add(g:spacevim_project_rooter_patterns, '.clang') +let g:clang2_placeholder_next = '' +let g:clang2_placeholder_prev = '' endfunction function! SpaceVim#layers#lang#c#set_variable(var) abort diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index ad55618a5..89af2211b 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -93,6 +93,7 @@ endfunction function! SpaceVim#layers#lang#java#config() abort call SpaceVim#mapping#space#regesit_lang_mappings('java', function('s:language_specified_mappings')) call SpaceVim#plugins#repl#reg('java', 'jshell') + call add(g:spacevim_project_rooter_patterns, 'pom.xml') augroup SpaceVim_lang_java au! autocmd FileType java setlocal omnifunc=javacomplete#Complete diff --git a/autoload/SpaceVim/layers/tools.vim b/autoload/SpaceVim/layers/tools.vim index 8b4d8b6dd..8babc814c 100644 --- a/autoload/SpaceVim/layers/tools.vim +++ b/autoload/SpaceVim/layers/tools.vim @@ -44,8 +44,6 @@ function! SpaceVim#layers#tools#plugins() abort \ ['vim-scripts/TaskList.vim', { 'on_cmd' : 'TaskList'}], \ ['MarcWeber/vim-addon-mw-utils'], \ ['vim-scripts/taglist.vim', { 'on_cmd' : 'TlistToggle', 'loadconf' : 1}], - \ ['scrooloose/nerdtree', { 'on_cmd' : 'NERDTreeToggle', - \ 'loadconf' : 1}], \ ['Xuyuanp/nerdtree-git-plugin'], \ ['lymslive/vimloo', {'merged' : 0}], \ ['lymslive/vnote', {'depends' : 'vimloo', diff --git a/autoload/SpaceVim/layers/unite.vim b/autoload/SpaceVim/layers/unite.vim index 74a7d1749..061a1f478 100644 --- a/autoload/SpaceVim/layers/unite.vim +++ b/autoload/SpaceVim/layers/unite.vim @@ -81,9 +81,6 @@ function! SpaceVim#layers#unite#plugins() abort call add(plugins, ['mattn/googlesuggest-complete-vim']) endif - if g:spacevim_filemanager ==# 'vimfiler' - call add(plugins, ['Shougo/vimfiler.vim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : ['VimFiler', 'VimFilerBufferDir']}]) - endif return plugins endfunction diff --git a/autoload/SpaceVim/plugins.vim b/autoload/SpaceVim/plugins.vim index 6dc74ee5b..06d9038ab 100644 --- a/autoload/SpaceVim/plugins.vim +++ b/autoload/SpaceVim/plugins.vim @@ -18,7 +18,7 @@ function! SpaceVim#plugins#load() abort endfunction function! s:load_plugins() abort - for group in g:spacevim_plugin_groups + for group in SpaceVim#layers#get() let g:_spacevim_plugin_layer = group for plugin in s:getLayerPlugins(group) if len(plugin) == 2 diff --git a/config/general.vim b/config/general.vim index a73b2b5d9..0717c1b4d 100644 --- a/config/general.vim +++ b/config/general.vim @@ -15,7 +15,7 @@ if g:spacevim_enable_guicolors == 1 set guicolors endif endif -if count(g:spacevim_plugin_groups, 'colorscheme') && g:spacevim_colorscheme !=# '' "{{{ +if SpaceVim#layers#isLoaded('colorscheme') && g:spacevim_colorscheme !=# '' "{{{ try exec 'set background=' . g:spacevim_colorscheme_bg exec 'colorscheme ' . g:spacevim_colorscheme diff --git a/config/plugins/denite.vim b/config/plugins/denite.vim index d3c78aba2..62defa200 100644 --- a/config/plugins/denite.vim +++ b/config/plugins/denite.vim @@ -107,7 +107,9 @@ call denite#custom#var('menu', 'unite_source_menu_compatibility', 1) let s:insert_mode_mappings = [ \ ['jk', '', 'noremap'], \ ['', '', 'noremap'], + \ ['', '', 'noremap'], \ ['', '', 'noremap'], + \ ['', '', 'noremap'], \ ['', '', 'noremap'], \ ['', '', 'noremap'], \ ['', '', 'noremap'], diff --git a/doc/SpaceVim.cnx b/doc/SpaceVim.cnx index 30812e9e5..9da37f4c2 100644 --- a/doc/SpaceVim.cnx +++ b/doc/SpaceVim.cnx @@ -404,11 +404,6 @@ Enable/Disable tabline filetype icon. default is 0. *g:spacevim_enable_os_fileformat_icon* Enable/Disable os fileformat icon. default is 0. - *g:spacevim_plugin_groups* -Plugin groups to be loaded. -> - let g:spacevim_plugin_groups = ['core', 'lang'] -< *g:spacevim_github_username* Set the github username, It will be used for getting your starred repos, and diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index a7cb15614..297dd55a0 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -406,12 +406,6 @@ Enable/Disable tabline filetype icon. default is 0. *g:spacevim_enable_os_fileformat_icon* Enable/Disable os fileformat icon. default is 0. - *g:spacevim_plugin_groups* -Plugin groups to be loaded. -> - let g:spacevim_plugin_groups = ['core', 'lang'] -< - *g:spacevim_github_username* Set the github username, It will be used for getting your starred repos, and fuzzy find the repo you want. diff --git a/ginit.vim b/ginit.vim index bc1abdf4f..25afac988 100644 --- a/ginit.vim +++ b/ginit.vim @@ -12,7 +12,7 @@ if exists('g:GuiLoaded') else exe 'Guifont! ' . g:spacevim_guifont endif - if count(g:spacevim_plugin_groups, 'colorscheme') && g:spacevim_colorscheme !=# '' "{{{ + if SpaceVim#layers#isLoaded('colorscheme') && g:spacevim_colorscheme !=# '' "{{{ try exec 'set background=' . g:spacevim_colorscheme_bg exec 'colorscheme ' . g:spacevim_colorscheme diff --git a/mode/basic.vim b/mode/basic.vim index 4282c87f7..f5a8d316f 100644 --- a/mode/basic.vim +++ b/mode/basic.vim @@ -1,9 +1,30 @@ -" Basic mode of SpaceVim, generated by SpaceVim automatically. +"============================================================================= +" basic.vim --- Basic mode of SpaceVim +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +" SpaceVim Options: {{{ + +" Disable true colors let g:spacevim_enable_guicolors = 0 + +" Use empty string as statusline separator let g:spacevim_statusline_separator = 'nil' + +" Use | as inactive separator of statusline let g:spacevim_statusline_inactive_separator = 'bar' + +" Use general integer as buffer index let g:spacevim_buffer_index_type = 4 + +" Disable Filetype icon let g:spacevim_enable_tabline_filetype_icon = 0 + +" Disable mode in statusline let g:spacevim_enable_statusline_display_mode = 0 +" }}} diff --git a/mode/dark_powered.vim b/mode/dark_powered.vim index 3fb642c2f..36693b84b 100644 --- a/mode/dark_powered.vim +++ b/mode/dark_powered.vim @@ -1,6 +1,24 @@ -" Dark powered mode of SpaceVim, generated by SpaceVim automatically. +"============================================================================= +" dark_powered.vim --- Dark powered mode of SpaceVim +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +" SpaceVim Options: {{{ let g:spacevim_enable_debug = 1 let g:spacevim_realtime_leader_guide = 1 +let g:spacevim_enable_tabline_filetype_icon = 1 +let g:spacevim_enable_statusline_display_mode = 0 +let g:spacevim_enable_os_fileformat_icon = 1 +let g:spacevim_buffer_index_type = 1 +let g:spacevim_enable_vimfiler_welcome = 1 +let g:spacevim_enable_debug = 1 +" }}} + +" SpaceVim Layers: {{{ call SpaceVim#layers#load('incsearch') call SpaceVim#layers#load('lang#c') call SpaceVim#layers#load('lang#elixir') @@ -19,25 +37,6 @@ call SpaceVim#layers#load('lang#vim') call SpaceVim#layers#load('lang#xml') call SpaceVim#layers#load('shell') call SpaceVim#layers#load('tools#screensaver') -let g:spacevim_enable_vimfiler_welcome = 1 -let g:spacevim_enable_debug = 1 -let g:deoplete#auto_complete_delay = 150 -let g:spacevim_enable_tabline_filetype_icon = 1 -let g:spacevim_enable_statusline_display_mode = 0 -let g:spacevim_enable_os_fileformat_icon = 1 -let g:spacevim_buffer_index_type = 1 -let g:neomake_vim_enabled_makers = [] -if executable('vimlint') - call add(g:neomake_vim_enabled_makers, 'vimlint') -endif -if executable('vint') - call add(g:neomake_vim_enabled_makers, 'vint') -endif -if has('python3') - let g:ctrlp_map = '' - nnoremap :Denite file_rec -endif -let g:clang2_placeholder_next = '' -let g:clang2_placeholder_prev = '' +" }}}