1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

Improve core config (#1455)

* Improve core config

* Fixup

* Update mode

* Remove plugin groups

* Enable denite layer if has +py3

* Update dev scripts

* Add project patten pom.xml for java layer

* Add tools layer
This commit is contained in:
Wang Shidong 2018-03-03 21:52:08 +08:00 committed by GitHub
parent 6100f7d7da
commit e55d6cf270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 121 additions and 98 deletions

View File

@ -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

View File

@ -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]

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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('<sfile>:~')
@ -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

View File

@ -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'

View File

@ -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 <silent> <C-p> :Denite file_rec<cr>
endfunction
" vim:set et sw=2 cc=80:

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -107,7 +107,9 @@ call denite#custom#var('menu', 'unite_source_menu_compatibility', 1)
let s:insert_mode_mappings = [
\ ['jk', '<denite:enter_mode:normal>', 'noremap'],
\ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
\ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
\ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
\ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
\ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
\ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
\ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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
" }}}

View File

@ -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 <silent> <C-p> :Denite file_rec<CR>
endif
let g:clang2_placeholder_next = ''
let g:clang2_placeholder_prev = ''
" }}}