1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 12:49:10 +08:00

reduce default plugins (#1932)

This commit is contained in:
Wang Shidong 2018-07-12 20:57:06 +08:00 committed by GitHub
parent cbce52e8e2
commit 7ff72c7136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 119 additions and 77 deletions

View File

@ -54,6 +54,7 @@ function! SpaceVim#autocmds#init() abort
autocmd FocusLost * call system('synclient touchpadoff=0')
autocmd FocusGained * call s:reload_touchpad_status()
endif
autocmd BufWritePre * call SpaceVim#plugins#mkdir#CreateCurrent()
autocmd BufWritePost *.vim call s:generate_doc()
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
autocmd ColorScheme gruvbox,jellybeans,nord call s:fix_VertSplit()

View File

@ -142,7 +142,6 @@ function! SpaceVim#default#layers() abort
call SpaceVim#layers#load('core#banner')
call SpaceVim#layers#load('core#statusline')
call SpaceVim#layers#load('core#tabline')
call SpaceVim#layers#load('sudo')
endfunction
function! SpaceVim#default#keyBindings() abort

View File

@ -8,15 +8,17 @@
function! SpaceVim#layers#chinese#plugins() abort
let plugins = [
\ ['yianwillis/vimcdoc', {'merged' : 0}],
\ ]
if SpaceVim#layers#isLoaded('ctrlp')
call add(plugins, ['vimcn/ctrlp.cnx', {'merged' : 0}])
endif
return plugins
let plugins = [
\ ['yianwillis/vimcdoc', {'merged' : 0}],
\ ['ianva/vim-youdao-translater', { 'on_cmd' : ['Ydv','Ydc','Yde']}],
\ ]
if SpaceVim#layers#isLoaded('ctrlp')
call add(plugins, ['vimcn/ctrlp.cnx', {'merged' : 0}])
endif
return plugins
endfunction
function! SpaceVim#layers#chinese#config() abort
let g:_spacevim_mappings_space.x.g = {'name' : '+translate'}
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1)
endfunction

View File

@ -11,15 +11,14 @@ function! SpaceVim#layers#core#plugins() abort
if g:spacevim_filemanager ==# 'nerdtree'
call add(plugins, ['scrooloose/nerdtree', { 'on_cmd' : 'NERDTreeToggle',
\ 'loadconf' : 1}])
call add(plugins, ['Xuyuanp/nerdtree-git-plugin', {'merged' : 0}])
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' : [(executable('gmake') ? 'gmake' : 'make')]}])
endif
call add(plugins, ['benizi/vim-automkdir'])
call add(plugins, ['rhysd/clever-f.vim'])
call add(plugins, ['scrooloose/nerdcommenter', { 'loadconf' : 1}])
call add(plugins, ['andymass/vim-matchup'])
call add(plugins, ['morhetz/gruvbox', {'loadconf' : 1, 'merged' : 0}])
@ -218,6 +217,26 @@ function! SpaceVim#layers#core#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1)
call SpaceVim#mapping#gd#add('HelpDescribe', function('s:gotodef'))
let g:_spacevim_mappings_space.c = {'name' : '+Comments'}
"
" Comments sections
"
" Toggles the comment state of the selected line(s). If the topmost selected
" line is commented, all selected lines are uncommented and vice versa.
call SpaceVim#mapping#space#def('nmap', ['c', 'l'], '<Plug>NERDCommenterInvert', 'comment or uncomment lines', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'L'], '<Plug>NERDCommenterInvert', 'comment or uncomment lines invert', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'v'], '<Plug>NERDCommenterInvertgv', 'comment or uncomment lines and keep visual', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'p'], 'vip<Plug>NERDCommenterComment', 'comment paragraphs', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'P'], 'vip<Plug>NERDCommenterInvert', 'toggle comment paragraphs', 0, 1)
nnoremap <silent> <Plug>CommentToLine :call <SID>comment_to_line(0)<Cr>
nnoremap <silent> <Plug>CommentToLineInvert :call <SID>comment_to_line(1)<Cr>
call SpaceVim#mapping#space#def('nmap', ['c', 't'], '<Plug>CommentToLine', 'comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'T'], '<Plug>CommentToLineInvert', 'toggle comment until the line', 0, 1)
nnoremap <silent> <Plug>CommentOperator :set opfunc=<SID>commentOperator<Cr>g@
let g:_spacevim_mappings_space[';'] = ['call feedkeys("\<Plug>CommentOperator")', 'comment operator']
nmap <silent> [SPC]; <Plug>CommentOperator
endfunction
function! s:gotodef() abort
@ -537,3 +556,44 @@ function! s:buffer_transient_state() abort
\ )
call state.open()
endfunction
function! s:commentOperator(type, ...) abort
let sel_save = &selection
let &selection = 'inclusive'
let reg_save = @@
if a:0 " Invoked from Visual mode, use gv command.
silent exe 'normal! gv'
call feedkeys("\<Plug>NERDCommenterComment")
elseif a:type ==# 'line'
call feedkeys('`[V`]')
call feedkeys("\<Plug>NERDCommenterComment")
else
call feedkeys('`[v`]')
call feedkeys("\<Plug>NERDCommenterComment")
endif
let &selection = sel_save
let @@ = reg_save
set opfunc=
endfunction
function! s:comment_to_line(invert) abort
let input = input('line number: ')
if empty(input)
return
endif
let line = str2nr(input)
let ex = line - line('.')
if ex > 0
exe 'normal! V'. ex .'j'
elseif ex == 0
else
exe 'normal! V'. abs(ex) .'k'
endif
if a:invert
call feedkeys("\<Plug>NERDCommenterInvert")
else
call feedkeys("\<Plug>NERDCommenterComment")
endif
endfunction

View File

@ -23,7 +23,6 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['kana/vim-textobj-indent'],
\ ['kana/vim-textobj-line'],
\ ['kana/vim-textobj-entire'],
\ ['scrooloose/nerdcommenter', { 'loadconf' : 1}],
\ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}],
\ ['easymotion/vim-easymotion'],
\ ['haya14busa/vim-easyoperator-line'],
@ -31,7 +30,6 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['osyo-manga/vim-jplus', { 'on_map' : '<Plug>(jplus' }],
\ ['godlygeek/tabular', { 'on_cmd' : 'Tabularize'}],
\ ['ntpeters/vim-better-whitespace', { 'on_cmd' : 'StripWhitespace'}],
\ ['ianva/vim-youdao-translater', { 'on_cmd' : ['Ydv','Ydc','Yde']}],
\ ]
if executable('fcitx')
call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}])
@ -144,9 +142,6 @@ function! SpaceVim#layers#edit#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call('
\ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])',
\ 'insert lorem-ipsum sentence', 1)
let g:_spacevim_mappings_space.x.g = {'name' : '+translate'}
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1)
" move line
call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call('
\ . string(s:_function('s:move_text_down_transient_state')) . ', [])',

View File

@ -15,6 +15,9 @@ function! SpaceVim#layers#git#plugins() abort
else
call add(plugins, ['lambdalisue/vim-gita', { 'on_cmd' : 'Gita'}])
endif
if g:spacevim_filemanager ==# 'nerdtree'
call add(plugins, ['Xuyuanp/nerdtree-git-plugin', {'merged' : 0}])
endif
return plugins
endfunction

View File

@ -23,6 +23,7 @@ function! SpaceVim#layers#lang#markdown#plugins() abort
call add(plugins, ['mzlogin/vim-markdown-toc',{ 'on_ft' : 'markdown'}])
call add(plugins, ['iamcco/mathjax-support-for-mkdp',{ 'on_ft' : 'markdown'}])
call add(plugins, ['iamcco/markdown-preview.vim', { 'depends' : 'open-browser.vim', 'on_ft' : 'markdown' }])
call add(plugins, ['lvht/tagbar-markdown',{'merged' : 0}])
return plugins
endfunction

View File

@ -13,7 +13,6 @@ function! SpaceVim#layers#ui#plugins() abort
\ ['majutsushi/tagbar', {'loadconf' : 1}],
\ ['tenfyzhong/tagbar-makefile.vim', {'merged': 0}],
\ ['tenfyzhong/tagbar-proto.vim', {'merged': 0}],
\ ['lvht/tagbar-markdown',{'merged' : 0}],
\ ['t9md/vim-choosewin', {'merged' : 0}],
\ ['mhinz/vim-startify', {'loadconf' : 1, 'merged' : 0}],
\ ]

View File

@ -18,7 +18,6 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.T = {'name' : '+UI toggles/themes'}
let g:_spacevim_mappings_space.a = {'name' : '+Applications'}
let g:_spacevim_mappings_space.b = {'name' : '+Buffers'}
let g:_spacevim_mappings_space.c = {'name' : '+Comments'}
let g:_spacevim_mappings_space.f = {'name' : '+Files'}
let g:_spacevim_mappings_space.j = {'name' : '+Jump/Join/Split'}
let g:_spacevim_mappings_space.m = {'name' : '+Major-mode'}
@ -144,25 +143,6 @@ function! SpaceVim#mapping#space#init() abort
\ ]
\ ]
\ , 1)
"
" Comments sections
"
" Toggles the comment state of the selected line(s). If the topmost selected
" line is commented, all selected lines are uncommented and vice versa.
call SpaceVim#mapping#space#def('nmap', ['c', 'l'], '<Plug>NERDCommenterInvert', 'comment or uncomment lines', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'L'], '<Plug>NERDCommenterInvert', 'comment or uncomment lines invert', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'v'], '<Plug>NERDCommenterInvertgv', 'comment or uncomment lines and keep visual', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'p'], 'vip<Plug>NERDCommenterComment', 'comment paragraphs', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'P'], 'vip<Plug>NERDCommenterInvert', 'toggle comment paragraphs', 0, 1)
nnoremap <silent> <Plug>CommentToLine :call <SID>comment_to_line(0)<Cr>
nnoremap <silent> <Plug>CommentToLineInvert :call <SID>comment_to_line(1)<Cr>
call SpaceVim#mapping#space#def('nmap', ['c', 't'], '<Plug>CommentToLine', 'comment until the line', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['c', 'T'], '<Plug>CommentToLineInvert', 'toggle comment until the line', 0, 1)
nnoremap <silent> <Plug>CommentOperator :set opfunc=<SID>commentOperator<Cr>g@
let g:_spacevim_mappings_space[';'] = ['call feedkeys("\<Plug>CommentOperator")', 'comment operator']
nmap <silent> [SPC]; <Plug>CommentOperator
let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'}
let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'}
@ -463,46 +443,6 @@ function! SpaceVim#mapping#space#langSPC(m, keys, cmd, desc, is_cmd) abort
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
endfunction
function! s:commentOperator(type, ...) abort
let sel_save = &selection
let &selection = 'inclusive'
let reg_save = @@
if a:0 " Invoked from Visual mode, use gv command.
silent exe 'normal! gv'
call feedkeys("\<Plug>NERDCommenterComment")
elseif a:type ==# 'line'
call feedkeys('`[V`]')
call feedkeys("\<Plug>NERDCommenterComment")
else
call feedkeys('`[v`]')
call feedkeys("\<Plug>NERDCommenterComment")
endif
let &selection = sel_save
let @@ = reg_save
set opfunc=
endfunction
function! s:comment_to_line(invert) abort
let input = input('line number: ')
if empty(input)
return
endif
let line = str2nr(input)
let ex = line - line('.')
if ex > 0
exe 'normal! V'. ex .'j'
elseif ex == 0
else
exe 'normal! V'. abs(ex) .'k'
endif
if a:invert
call feedkeys("\<Plug>NERDCommenterInvert")
else
call feedkeys("\<Plug>NERDCommenterComment")
endif
endfunction
function! s:create_new_named_tab() abort
let tabname = input('Tab name:', '')

View File

@ -0,0 +1,41 @@
"=============================================================================
" mkdir.vim --- auto mkdir when saving file
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:save_cpo = &cpo
set cpo&vim
function! SpaceVim#plugins#mkdir#CreateCurrent() abort
call s:CreateDirectory(expand('%:p:h'))
endfunction
fun! s:Mkdirp(dir) abort
if exists('*mkdir')
call mkdir(a:dir, 'p')
else
" @todo mkdir only exist in *nix os
call system('mkdir -p '.shellescape(a:dir))
end
endf
fun! s:CreateDirectory(dir) abort
let d = a:dir
" @todo do not skip files that have schemes
if d =~? '^[a-z]\+:/'
return
endif
if !isdirectory(d)
call s:Mkdirp(d)
end
endf
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -26,6 +26,7 @@ The next release is v0.9.0.
- Change the option name `enable_statusline_display_mode` to `enable_statusline_mode` ([#1843](https://github.com/SpaceVim/SpaceVim/pull/1843))
- Recover spell and list option in go layer ([#1872](https://github.com/SpaceVim/SpaceVim/pull/1872))
- Remove textwidth option in autocmd ([#1931](https://github.com/SpaceVim/SpaceVim/pull/1931))
- Reduce number of default plugins ([#1932](https://github.com/SpaceVim/SpaceVim/pull/1932))
### Fixed