diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 96510f3ac..ece63102d 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -83,6 +83,12 @@ let g:spacevim_plugin_groups_exclude = [] " now Space Vim support these groups: let g:spacevim_plugin_groups = [] "" +" Disable plugins by names. +" example: > +" let g:spacevim_disabled_plugins = ['vim-foo', 'vim-bar'] +" < +let g:spacevim_disabled_plugins = [] +"" " enable/disable SpaceVim with powerline symbols. let g:spacevim_enable_powerline_fonts = 1 let g:spacevim_smartcloseignorewin = ['__Tagbar__' , 'vimfiler:default'] @@ -155,43 +161,8 @@ endfunction function! SpaceVim#default() abort - call add(g:spacevim_plugin_groups, 'web') - call add(g:spacevim_plugin_groups, 'lang') - call add(g:spacevim_plugin_groups, 'checkers') - call add(g:spacevim_plugin_groups, 'chat') - call add(g:spacevim_plugin_groups, 'javascript') - call add(g:spacevim_plugin_groups, 'ruby') - call add(g:spacevim_plugin_groups, 'python') - call add(g:spacevim_plugin_groups, 'scala') - call add(g:spacevim_plugin_groups, 'go') - call add(g:spacevim_plugin_groups, 'scm') - call add(g:spacevim_plugin_groups, 'editing') - call add(g:spacevim_plugin_groups, 'indents') - call add(g:spacevim_plugin_groups, 'navigation') - call add(g:spacevim_plugin_groups, 'misc') - - call add(g:spacevim_plugin_groups, 'core') - call add(g:spacevim_plugin_groups, 'unite') - call add(g:spacevim_plugin_groups, 'github') - if has('python3') - call add(g:spacevim_plugin_groups, 'denite') - endif - call add(g:spacevim_plugin_groups, 'ctrlp') - call add(g:spacevim_plugin_groups, 'autocomplete') - if ! has('nvim') - call add(g:spacevim_plugin_groups, 'vim') - else - call add(g:spacevim_plugin_groups, 'nvim') - endif - if OSX() - call add(g:spacevim_plugin_groups, 'osx') - endif - if WINDOWS() - call add(g:spacevim_plugin_groups, 'windows') - endif - if LINUX() - call add(g:spacevim_plugin_groups, 'linux') - endif + call SpaceVim#default#SetOptions() + call SpaceVim#default#SetPlugins() endfunction function! SpaceVim#defindFuncs() abort diff --git a/autoload/SpaceVim/default.vim b/autoload/SpaceVim/default.vim index e69de29bb..0d1a22b9f 100644 --- a/autoload/SpaceVim/default.vim +++ b/autoload/SpaceVim/default.vim @@ -0,0 +1,140 @@ +function! SpaceVim#default#SetOptions() abort + " basic vim settiing + if has('gui_running') + set guioptions-=m " Hide menu bar. + set guioptions-=T " Hide toolbar + set guioptions-=L " Hide left-hand scrollbar + set guioptions-=r " Hide right-hand scrollbar + set guioptions-=b " Hide bottom scrollbar + set showtabline=0 " Hide tabline + if WINDOWS() + " please install the font in 'Dotfiles\font' + set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT + elseif OSX() + set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 + else + set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 11 + endif + if !empty(g:spacevim_guifont) + exe 'set guifont=' . g:spacevim_guifont + endif + endif + + " indent use backspace delete indent, eol use backspace delete line at + " begining start delete the char you just typed in if you do not use set + " nocompatible ,you need this + set backspace=indent,eol,start + + " Shou number and relativenumber + set relativenumber + set number + + " indent + set autoindent + set smartindent + set cindent + + " show wildmenu + set wildmenu + + " do not break words. + set linebreak + + " tab options: + set tabstop=4 + set expandtab + set softtabstop=4 + set shiftwidth=4 + + " backup + set backup + set undofile + set undolevels=1000 + let g:data_dir = $HOME . '/.data/' + let g:backup_dir = g:data_dir . 'backup' + let g:swap_dir = g:data_dir . 'swap' + let g:undo_dir = g:data_dir . 'undofile' + if finddir(g:data_dir) ==# '' + silent call mkdir(g:data_dir) + endif + if finddir(g:backup_dir) ==# '' + silent call mkdir(g:backup_dir) + endif + if finddir(g:swap_dir) ==# '' + silent call mkdir(g:swap_dir) + endif + if finddir(g:undo_dir) ==# '' + silent call mkdir(g:undo_dir) + endif + unlet g:backup_dir + unlet g:swap_dir + unlet g:data_dir + unlet g:undo_dir + set undodir=$HOME/.data/undofile + set backupdir=$HOME/.data/backup + set directory=$HOME/.data/swap + set nofoldenable " no fold enable + set nowritebackup + set matchtime=0 + set ruler + set showcmd + set showmatch + set showmode + "menuone: show the pupmenu when only one match + set completeopt=menu,menuone,longest " disable preview scratch window, + set complete=.,w,b,u,t " h: 'complete' + set pumheight=15 " limit completion menu height + set scrolloff=7 + set incsearch + set autowrite + set hlsearch + set laststatus=2 + set completeopt=longest,menu + set wildignorecase + let g:markdown_fenced_languages = ['vim', 'java', 'bash=sh', 'sh', 'html', 'python'] + set mouse= + set hidden + set ttimeout + set ttimeoutlen=50 +endfunction + +function! SpaceVim#default#SetPlugins() abort + + call add(g:spacevim_plugin_groups, 'web') + call add(g:spacevim_plugin_groups, 'lang') + call add(g:spacevim_plugin_groups, 'checkers') + call add(g:spacevim_plugin_groups, 'chat') + call add(g:spacevim_plugin_groups, 'javascript') + call add(g:spacevim_plugin_groups, 'ruby') + call add(g:spacevim_plugin_groups, 'python') + call add(g:spacevim_plugin_groups, 'scala') + call add(g:spacevim_plugin_groups, 'go') + call add(g:spacevim_plugin_groups, 'scm') + call add(g:spacevim_plugin_groups, 'editing') + call add(g:spacevim_plugin_groups, 'indents') + call add(g:spacevim_plugin_groups, 'navigation') + call add(g:spacevim_plugin_groups, 'misc') + + call add(g:spacevim_plugin_groups, 'core') + call add(g:spacevim_plugin_groups, 'unite') + call add(g:spacevim_plugin_groups, 'github') + if has('python3') + call add(g:spacevim_plugin_groups, 'denite') + endif + call add(g:spacevim_plugin_groups, 'ctrlp') + call add(g:spacevim_plugin_groups, 'autocomplete') + if ! has('nvim') + call add(g:spacevim_plugin_groups, 'vim') + else + call add(g:spacevim_plugin_groups, 'nvim') + endif + if OSX() + call add(g:spacevim_plugin_groups, 'osx') + endif + if WINDOWS() + call add(g:spacevim_plugin_groups, 'windows') + endif + if LINUX() + call add(g:spacevim_plugin_groups, 'linux') + endif +endfunction diff --git a/config/general.vim b/config/general.vim index 812364b1f..6cf670047 100644 --- a/config/general.vim +++ b/config/general.vim @@ -1,105 +1,5 @@ scriptencoding utf-8 -" basic vim settiing -if has("gui_running") - set guioptions-=m " 隐藏菜单栏 - set guioptions-=T " 隐藏工具栏 - set guioptions-=L " 隐藏左侧滚动条 - set guioptions-=r " 隐藏右侧滚动条 - set guioptions-=b " 隐藏底部滚动条 - set showtabline=0 " 隐藏Tab栏 - if WINDOWS() - " please install the font in 'Dotfiles\font' - set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT - elseif OSX() - set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 - else - set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 11 - endif - if !empty(g:spacevim_guifont) - exe 'set guifont=' . g:spacevim_guifont - endif -endif - -" indent use backspace delete indent, eol use backspace delete line at -" begining start delete the char you just typed in if you do not use set -" nocompatible ,you need this -set backspace=indent,eol,start - -"显示相对行号 -set relativenumber - -" 显示行号 -set number - -" 自动缩进,自动智能对齐 -set autoindent -set smartindent -set cindent - -" 状态栏预览命令 -set wildmenu - -"整词换行 -set linebreak - -"Tab键的宽度 -set tabstop=4 -"用空格来执行tab -set expandtab -" 统一缩进为4 -set softtabstop=4 -set shiftwidth=4 -"set nobackup -set backup -set undofile -set undolevels=1000 -let g:data_dir = $HOME . '/.data/' -let g:backup_dir = g:data_dir . 'backup' -let g:swap_dir = g:data_dir . 'swap' -let g:undo_dir = g:data_dir . 'undofile' -if finddir(g:data_dir) == '' - silent call mkdir(g:data_dir) -endif -if finddir(g:backup_dir) == '' - silent call mkdir(g:backup_dir) -endif -if finddir(g:swap_dir) == '' - silent call mkdir(g:swap_dir) -endif -if finddir(g:undo_dir) == '' - silent call mkdir(g:undo_dir) -endif -unlet g:backup_dir -unlet g:swap_dir -unlet g:data_dir -unlet g:undo_dir -set undodir=$HOME/.data/undofile -set backupdir=$HOME/.data/backup -set directory=$HOME/.data/swap -set nofoldenable "关闭自动折叠 折叠按键 'za' -set nowritebackup -set matchtime=0 -set ruler -set showcmd "命令行显示输入的命令 -set showmatch "设置匹配模式,显示匹配的括号 -set showmode "命令行显示当前vim的模式 -"menuone: show the pupmenu when only one match -set completeopt=menu,menuone,longest " disable preview scratch window, -set complete=.,w,b,u,t " h: 'complete' -set pumheight=15 " limit completion menu height -set scrolloff=7 "最低显示行数 -set incsearch -set autowrite -set hlsearch -set laststatus=2 -set completeopt=longest,menu exe "set wildignore+=" . g:spacevim_wildignore -set wildignorecase -let g:markdown_fenced_languages = ['vim', 'java', 'bash=sh', 'sh', 'html', 'python'] -set mouse= -set hidden -set ttimeout -set ttimeoutlen=50 " shell if has('filterpipe') set noshelltemp diff --git a/config/plugins.vim b/config/plugins.vim index b4bf890e0..276cf946d 100644 --- a/config/plugins.vim +++ b/config/plugins.vim @@ -195,6 +195,12 @@ function! s:load_plugins() abort endfor endfunction +function! s:disable_plugins(plugin_list) abort + for name in a:plugin_list + call dein#disable(name) + endfor +endfunction + if zvim#plug#enable_plug() call zvim#plug#begin(g:spacevim_plugin_bundle_dir) call zvim#plug#fetch() @@ -444,5 +450,8 @@ if zvim#plug#enable_plug() " google plugins call zvim#plug#add('google/vim-searchindex') call zvim#plug#add('Yggdroot/LeaderF', {'merged' : 0}) + + call s:disable_plugins(g:spacevim_disabled_plugins) + call zvim#plug#end() endif diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 1d6768a78..a581ee5b5 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -77,6 +77,12 @@ example: < now Space Vim support these groups: + *g:spacevim_disabled_plugins* +Disable plugins by names. example: +> + let g:spacevim_disabled_plugins = ['vim-foo', 'vim-bar'] +< + *g:spacevim_enable_powerline_fonts* enable/disable SpaceVim with powerline symbols.