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

Better default

Fix up

Fix up

Fix up

Fix rtp

Update project layout

Fix colorscheme layer

Add colorsheme

close #1308

Close #1307

Set default fillchars

Move cache to cache

Disable lang layer

Remove layers

Fix crash

ref : https://github.com/neovim/neovim/issues/7876

Fix plugin manager

Filter same filename:linenumber in flygrep

Fix type
This commit is contained in:
wsdjeg 2018-02-22 21:15:46 +08:00
parent 14cf41a944
commit 3ac76a0ca8
21 changed files with 393 additions and 187 deletions

View File

@ -104,11 +104,15 @@ The easist way is to download [install.cmd](https://spacevim.org/install.cmd) an
### Project layout ### Project layout
```txt ```txt
├─ autoload/SpaceVim/api/ APIs ├─ .ci/ build automation
├─ autoload/SpaceVim/layers/ layers ├─ .github/ issue/PR templates
├─ autoload/SpaceVim/plugins/ plugins ├─ .SpaceVim.d/ project specific configuration
├─ autoload/SpaceVim.vim SpaceVim core file
├─ autoload/SpaceVim/api/ Public APIs
├─ autoload/SpaceVim/layers/ available layers
├─ autoload/SpaceVim/plugins/ buildin plugins
├─ autoload/SpaceVim/mapping/ mapping guide ├─ autoload/SpaceVim/mapping/ mapping guide
├─ doc/SpaceVim.txt help ├─ doc/ help(cn/en)
├─ docs/ website(cn/en) ├─ docs/ website(cn/en)
├─ wiki/ wiki(cn/en) ├─ wiki/ wiki(cn/en)
├─ bin/ executeable ├─ bin/ executeable

View File

@ -24,11 +24,14 @@
" settings in `.SpaceVim.d/init.vim` in the root directory of your project. " settings in `.SpaceVim.d/init.vim` in the root directory of your project.
" `.SpaceVim.d/` will also be added to runtimepath. " `.SpaceVim.d/` will also be added to runtimepath.
" Public SpaceVim Options {{{
scriptencoding utf-8
"" ""
" Version of SpaceVim , this value can not be changed. " Version of SpaceVim , this value can not be changed.
scriptencoding utf-8
let g:spacevim_version = '0.7.0-dev' let g:spacevim_version = '0.7.0-dev'
lockvar g:spacevim_version lockvar g:spacevim_version
"" ""
" Change the default indentation of SpaceVim. Default is 2. " Change the default indentation of SpaceVim. Default is 2.
" > " >
@ -480,9 +483,12 @@ let g:spacevim_wildignore
\ = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg, \ = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,
\*.ttf,*.TTF,*.png,*/target/*, \*.ttf,*.TTF,*.png,*/target/*,
\.git,.svn,.hg,.DS_Store,*.svg' \.git,.svn,.hg,.DS_Store,*.svg'
" privite options
" }}}
" Privite SpaceVim options
let g:_spacevim_mappings = {} let g:_spacevim_mappings = {}
" TODO merge leader guide
let g:_spacevim_mappings_space_custom = [] let g:_spacevim_mappings_space_custom = []
let g:_spacevim_mappings_space_custom_group_name = [] let g:_spacevim_mappings_space_custom_group_name = []
@ -597,6 +603,8 @@ endfunction
function! SpaceVim#end() abort function! SpaceVim#end() abort
call SpaceVim#server#connect()
if g:spacevim_enable_neocomplcache if g:spacevim_enable_neocomplcache
let g:spacevim_autocomplete_method = 'neocomplcache' let g:spacevim_autocomplete_method = 'neocomplcache'
endif endif
@ -649,8 +657,12 @@ function! SpaceVim#end() abort
endif endif
"" ""
" generate tags for SpaceVim " generate tags for SpaceVim
let help = fnamemodify(g:Config_Main_Home, ':p:h:h') . '/doc' let help = fnamemodify(g:_spacevim_root_dir, ':p:h:h') . '/doc'
exe 'helptags ' . help try
exe 'helptags ' . help
catch
call SpaceVim#logger#warn('Failed to generate helptags for SpaceVim')
endtry
"" ""
" set language " set language
@ -664,6 +676,8 @@ function! SpaceVim#end() abort
if !g:spacevim_relativenumber if !g:spacevim_relativenumber
set norelativenumber set norelativenumber
else
set relativenumber
endif endif
let &shiftwidth = g:spacevim_default_indent let &shiftwidth = g:spacevim_default_indent
@ -674,10 +688,59 @@ function! SpaceVim#end() abort
endif endif
let g:leaderGuide_max_size = 15 let g:leaderGuide_max_size = 15
call SpaceVim#plugins#load() call SpaceVim#plugins#load()
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
call zvim#util#source_rc('general.vim')
call SpaceVim#autocmds#init()
if has('nvim')
call zvim#util#source_rc('neovim.vim')
endif
call zvim#util#source_rc('commands.vim')
filetype plugin indent on
syntax on
endfunction endfunction
function! SpaceVim#default() abort function! SpaceVim#begin() abort
call zvim#util#source_rc('functions.vim')
call zvim#util#source_rc('init.vim')
" Before loading SpaceVim, We need to parser argvs.
function! s:parser_argv() abort
if !argc()
return [1, getcwd()]
elseif argv(0) =~# '/$'
let f = expand(argv(0))
if isdirectory(f)
return [1, f]
else
return [1, getcwd()]
endif
elseif argv(0) ==# '.'
return [1, getcwd()]
elseif isdirectory(expand(argv(0)))
return [1, expand(argv(0)) ]
else
return [0]
endif
endfunction
let s:status = s:parser_argv()
" If do not start Vim with filename, Define autocmd for opening welcome page
if s:status[0]
let g:_spacevim_enter_dir = s:status[1]
augroup SPwelcome
au!
autocmd VimEnter * call SpaceVim#welcome()
augroup END
endif
call SpaceVim#default#SetOptions() call SpaceVim#default#SetOptions()
call SpaceVim#default#SetPlugins() call SpaceVim#default#SetPlugins()
call SpaceVim#default#SetMappings() call SpaceVim#default#SetMappings()

View File

@ -8,7 +8,7 @@
let s:self = {} let s:self = {}
let s:completer = fnamemodify(g:Config_Main_Home, ':p:h:h') . '/autoload/SpaceVim/bin/get_complete' let s:completer = fnamemodify(g:_spacevim_root_dir, ':p:h:h') . '/autoload/SpaceVim/bin/get_complete'
let s:COP = SpaceVim#api#import('vim#compatible') let s:COP = SpaceVim#api#import('vim#compatible')

View File

@ -12,6 +12,7 @@ function! SpaceVim#api#data#list#get() abort
\ 'unshift' : '', \ 'unshift' : '',
\ 'uniq' : '', \ 'uniq' : '',
\ 'uniq_by' : '', \ 'uniq_by' : '',
\ 'uniq_by_func' : '',
\ 'clear' : '', \ 'clear' : '',
\ 'char_range' : '', \ 'char_range' : '',
\ 'has' : '', \ 'has' : '',
@ -71,6 +72,22 @@ function! s:uniq(list) abort
return s:uniq_by(a:list, 'v:val') return s:uniq_by(a:list, 'v:val')
endfunction endfunction
function! s:uniq_by_func(list, func) abort
let list = map(copy(a:list), '[v:val, call(a:func, [v:val])]')
let i = 0
let seen = {}
while i < len(list)
let key = string(list[i][1])
if has_key(seen, key)
call remove(list, i)
else
let seen[key] = 1
let i += 1
endif
endwhile
return map(list, 'v:val[0]')
endfunction
function! s:uniq_by(list, f) abort function! s:uniq_by(list, f) abort
let list = map(copy(a:list), printf('[v:val, %s]', a:f)) let list = map(copy(a:list), printf('[v:val, %s]', a:f))
let i = 0 let i = 0

View File

@ -40,14 +40,14 @@ endfunction
function! s:awesome_mode() abort function! s:awesome_mode() abort
let sep = SpaceVim#api#import('file').separator let sep = SpaceVim#api#import('file').separator
let f = fnamemodify(g:Config_Main_Home, ':h') . join(['', 'mode', 'dark_powered.vim'], sep) let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'dark_powered.vim'], sep)
let config = readfile(f, '') let config = readfile(f, '')
call s:write_to_config(config) call s:write_to_config(config)
endfunction endfunction
function! s:basic_mode() abort function! s:basic_mode() abort
let sep = SpaceVim#api#import('file').separator let sep = SpaceVim#api#import('file').separator
let f = fnamemodify(g:Config_Main_Home, ':h') . join(['', 'mode', 'basic.vim'], sep) let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'basic.vim'], sep)
let config = readfile(f, '') let config = readfile(f, '')
call s:write_to_config(config) call s:write_to_config(config)
endfunction endfunction

View File

@ -7,6 +7,7 @@
"============================================================================= "=============================================================================
scriptencoding utf-8 scriptencoding utf-8
" Default options {{{
function! SpaceVim#default#SetOptions() abort function! SpaceVim#default#SetOptions() abort
" basic vim settiing " basic vim settiing
if has('gui_running') if has('gui_running')
@ -31,14 +32,12 @@ function! SpaceVim#default#SetOptions() abort
" begining start delete the char you just typed in if you do not use set " begining start delete the char you just typed in if you do not use set
" nocompatible ,you need this " nocompatible ,you need this
set backspace=indent,eol,start set backspace=indent,eol,start
set smarttab
set nrformats-=octal
set listchars=tab:→\ ,eol:↵,trail,extends:↷,precedes:↶
set fillchars=vert:│,fold
" Shou number and relativenumber set laststatus=2
set relativenumber
set number
" set fillchar
hi VertSplit ctermbg=NONE guibg=NONE
set fillchars+=vert:│
" hide cmd " hide cmd
set noshowcmd set noshowcmd
@ -60,14 +59,17 @@ function! SpaceVim#default#SetOptions() abort
set softtabstop=4 set softtabstop=4
set shiftwidth=4 set shiftwidth=4
" autoread " Enable line number
set number
" Automatically read a file changed outside of vim
set autoread set autoread
" backup " backup
set backup set backup
set undofile set undofile
set undolevels=1000 set undolevels=1000
let g:data_dir = $HOME . '/.data/' let g:data_dir = $HOME . '/.cache/SpaceVim/'
let g:backup_dir = g:data_dir . 'backup' let g:backup_dir = g:data_dir . 'backup'
let g:swap_dir = g:data_dir . 'swap' let g:swap_dir = g:data_dir . 'swap'
let g:undo_dir = g:data_dir . 'undofile' let g:undo_dir = g:data_dir . 'undofile'
@ -83,13 +85,13 @@ function! SpaceVim#default#SetOptions() abort
if finddir(g:undo_dir) ==# '' if finddir(g:undo_dir) ==# ''
silent call mkdir(g:undo_dir) silent call mkdir(g:undo_dir)
endif endif
unlet g:data_dir
unlet g:backup_dir unlet g:backup_dir
unlet g:swap_dir unlet g:swap_dir
unlet g:data_dir
unlet g:undo_dir unlet g:undo_dir
set undodir=$HOME/.data/undofile set undodir=$HOME/.cache/SpaceVim/undofile
set backupdir=$HOME/.data/backup set backupdir=$HOME/.cache/SpaceVim/backup
set directory=$HOME/.data/swap set directory=$HOME/.cache/SpaceVim/swap
" no fold enable " no fold enable
set nofoldenable set nofoldenable
@ -105,21 +107,24 @@ function! SpaceVim#default#SetOptions() abort
set complete=.,w,b,u,t set complete=.,w,b,u,t
" limit completion menu height " limit completion menu height
set pumheight=15 set pumheight=15
set scrolloff=3 set scrolloff=1
set sidescrolloff=5
set display+=lastline
set incsearch set incsearch
set hlsearch set hlsearch
set laststatus=2
set wildignorecase set wildignorecase
set mouse=nv set mouse=nv
set hidden set hidden
set ttimeout set ttimeout
set ttimeoutlen=50 set ttimeoutlen=50
set lazyredraw
if has('patch-7.4.314') if has('patch-7.4.314')
" don't give ins-completion-menu messages. " don't give ins-completion-menu messages.
set shortmess+=c set shortmess+=c
endif endif
" Do not wrap lone lines
set nowrap
endfunction endfunction
"}}}
function! SpaceVim#default#SetPlugins() abort function! SpaceVim#default#SetPlugins() abort
@ -133,17 +138,6 @@ function! SpaceVim#default#SetPlugins() abort
call add(g:spacevim_plugin_groups, 'chat') call add(g:spacevim_plugin_groups, 'chat')
call add(g:spacevim_plugin_groups, 'git') call add(g:spacevim_plugin_groups, 'git')
call add(g:spacevim_plugin_groups, 'VersionControl') call add(g:spacevim_plugin_groups, 'VersionControl')
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, 'lang#go')
call add(g:spacevim_plugin_groups, 'lang#markdown')
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, 'core')
call SpaceVim#layers#load('core#banner') call SpaceVim#layers#load('core#banner')

View File

@ -12,7 +12,7 @@
" @subsection code completion " @subsection code completion
" SpaceVim uses neocomplete as the default completion engine if vim has lua " SpaceVim uses neocomplete as the default completion engine if vim has lua
" support. If there is no lua support, neocomplcache will be used for the " support. If there is no lua support, neocomplcache will be used for the
" completion engine. Spacevim uses deoplete as the default completion engine " completion engine. SpaceVim uses deoplete as the default completion engine
" for neovim. Deoplete requires neovim to be compiled with python support. For " for neovim. Deoplete requires neovim to be compiled with python support. For
" more information on python support, please read neovim's |provider-python|. " more information on python support, please read neovim's |provider-python|.
" "

View File

@ -149,39 +149,39 @@
function! SpaceVim#layers#colorscheme#plugins() abort function! SpaceVim#layers#colorscheme#plugins() abort
return [ return [
\ ['morhetz/gruvbox', {'loadconf' : 1}], \ ['morhetz/gruvbox', {'loadconf' : 1, 'merged' : 0}],
\ ['kristijanhusak/vim-hybrid-material'], \ ['kristijanhusak/vim-hybrid-material', { 'merged' : 0 }],
\ ['altercation/vim-colors-solarized'], \ ['altercation/vim-colors-solarized', { 'merged' : 0 }],
\ ['nanotech/jellybeans.vim'], \ ['nanotech/jellybeans.vim', { 'merged' : 0 }],
\ ['mhartington/oceanic-next'], \ ['mhartington/oceanic-next', { 'merged' : 0 }],
\ ['mhinz/vim-janah'], \ ['mhinz/vim-janah', { 'merged' : 0 }],
\ ['Gabirel/molokai'], \ ['Gabirel/molokai', { 'merged' : 0 }],
\ ['kabbamine/yowish.vim'], \ ['kabbamine/yowish.vim', { 'merged' : 0 }],
\ ['vim-scripts/wombat256.vim'], \ ['vim-scripts/wombat256.vim', { 'merged' : 0 }],
\ ['vim-scripts/twilight256.vim'], \ ['vim-scripts/twilight256.vim', { 'merged' : 0 }],
\ ['junegunn/seoul256.vim'], \ ['junegunn/seoul256.vim', { 'merged' : 0 }],
\ ['vim-scripts/rdark-terminal2.vim'], \ ['vim-scripts/rdark-terminal2.vim', { 'merged' : 0 }],
\ ['vim-scripts/pyte'], \ ['vim-scripts/pyte', { 'merged' : 0 }],
\ ['joshdick/onedark.vim'], \ ['joshdick/onedark.vim', { 'merged' : 0 }],
\ ['fmoralesc/molokayo'], \ ['fmoralesc/molokayo', { 'merged' : 0 }],
\ ['jonathanfilip/vim-lucius'], \ ['jonathanfilip/vim-lucius', { 'merged' : 0 }],
\ ['wimstefan/Lightning'], \ ['wimstefan/Lightning', { 'merged' : 0 }],
\ ['w0ng/vim-hybrid'], \ ['w0ng/vim-hybrid', { 'merged' : 0 }],
\ ['scheakur/vim-scheakur'], \ ['scheakur/vim-scheakur', { 'merged' : 0 }],
\ ['keith/parsec.vim'], \ ['keith/parsec.vim', { 'merged' : 0 }],
\ ['NLKNguyen/papercolor-theme'], \ ['NLKNguyen/papercolor-theme', { 'merged' : 0 }],
\ ['romainl/flattened'], \ ['romainl/flattened', { 'merged' : 0 }],
\ ['MaxSt/FlatColor'], \ ['SpaceVim/FlatColor', { 'merged' : 0 }],
\ ['chase/focuspoint-vim'], \ ['chase/focuspoint-vim', { 'merged' : 0 }],
\ ['chriskempson/base16-vim'], \ ['chriskempson/base16-vim', { 'merged' : 0 }],
\ ['gregsexton/Atom'], \ ['gregsexton/Atom', { 'merged' : 0 }],
\ ['gilgigilgil/anderson.vim'], \ ['gilgigilgil/anderson.vim', { 'merged' : 0 }],
\ ['romainl/Apprentice'], \ ['romainl/Apprentice', { 'merged' : 0 }],
\ ['icymind/NeoSolarized'], \ ['icymind/NeoSolarized', { 'merged' : 0 }],
\ ['jacoborus/tender'], \ ['jacoborus/tender', { 'merged' : 0 }],
\ ['wsdjeg/vim-one'], \ ['wsdjeg/vim-one', { 'merged' : 0 }],
\ ['arcticicestudio/nord-vim'], \ ['arcticicestudio/nord-vim', { 'merged' : 0 }],
\ ['KeitaNakamura/neodark.vim'], \ ['KeitaNakamura/neodark.vim', { 'merged' : 0 }]
\ ] \ ]
endfunction endfunction

View File

@ -0,0 +1,22 @@
" the theme colors should be
" [
" \ [ a_guifg, a_guibg, a_ctermfg, a_ctermbg],
" \ [ b_guifg, b_guibg, b_ctermfg, b_ctermbg],
" \ [ c_guifg, c_guibg, c_ctermfg, c_ctermbg],
" \ [ z_guibg, z_ctermbg],
" \ [ i_guifg, i_guibg, i_ctermfg, i_ctermbg],
" \ [ v_guifg, v_guibg, v_ctermfg, v_ctermbg],
" \ [ r_guifg, r_guibg, r_ctermfg, r_ctermbg],
" \ ]
function! SpaceVim#mapping#guide#theme#SpaceVim#palette() abort
return [
\ ['#282828' , '#FFA500' , 250, 97],
\ ['#d75fd7' , '#4e4e4e' , 170 , 239],
\ ['#c6c6c6' , '#3a3a3a' , 251 , 237],
\ ['#2c323c', 16],
\ ['#282828', '#00BFFF', 114, 152],
\ ['#2c323c', '#ff8787', 114, 210],
\ ['#2c323c', '#d75f5f', 114, 167],
\ ]
endfunction

View File

@ -12,6 +12,7 @@ let s:MPT = SpaceVim#api#import('prompt')
let s:JOB = SpaceVim#api#import('job') let s:JOB = SpaceVim#api#import('job')
let s:SYS = SpaceVim#api#import('system') let s:SYS = SpaceVim#api#import('system')
let s:BUFFER = SpaceVim#api#import('vim#buffer') let s:BUFFER = SpaceVim#api#import('vim#buffer')
let s:LIST = SpaceVim#api#import('data#list')
"}}} "}}}
" Init local options: {{{ " Init local options: {{{
@ -189,12 +190,17 @@ endfunction
let s:MPT._oninputpro = function('s:close_grep_job') let s:MPT._oninputpro = function('s:close_grep_job')
" }}} " }}}
function! s:file_line(line) abort
return matchstr(a:line, '[^:]*:\d\+:')
endfunction
" FlyGrep job handles: {{{ " FlyGrep job handles: {{{
" @vimlint(EVL103, 1, a:data) " @vimlint(EVL103, 1, a:data)
" @vimlint(EVL103, 1, a:id) " @vimlint(EVL103, 1, a:id)
" @vimlint(EVL103, 1, a:event) " @vimlint(EVL103, 1, a:event)
function! s:grep_stdout(id, data, event) abort function! s:grep_stdout(id, data, event) abort
let datas =filter(a:data, '!empty(v:val)') let datas =filter(a:data, '!empty(v:val)')
let datas = s:LIST.uniq_by_func(datas, function('s:file_line'))
if getline(1) ==# '' if getline(1) ==# ''
call setline(1, datas) call setline(1, datas)
else else

View File

@ -347,3 +347,5 @@ function! s:find_func_range() abort
return [line, line] return [line, line]
endfunction endfunction
" }}} " }}}
" vim:set et sw=2 cc=80 foldenable:

View File

@ -26,8 +26,8 @@ fu! zvim#util#defineMap(type,key,value,desc,...) abort
endf endf
fu! zvim#util#source_rc(file) abort fu! zvim#util#source_rc(file) abort
if filereadable(g:Config_Main_Home. '/' . a:file) if filereadable(g:_spacevim_root_dir. '/' . a:file)
execute 'source ' . g:Config_Main_Home . '/' . a:file execute 'source ' . g:_spacevim_root_dir . '/' . a:file
endif endif
endf endf

View File

@ -1,5 +1,5 @@
coverage: coverage:
range: 50..70 range: 30..60
round: down round: down
precision: 2 precision: 2
comment: comment:

137
colors/SpaceVim.vim Normal file
View File

@ -0,0 +1,137 @@
"=============================================================================
" SpaceVim.vim --- SpaceVim colorscheme
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
if !(has('termguicolors') && &termguicolors) && !has('gui_running') && &t_Co != 256
" prevent change statuslines
finish
else
let g:colors_name='SpaceVim'
endif
let s:HIAPI = SpaceVim#api#import('vim#highlight')
let s:COLOR = SpaceVim#api#import('color')
let s:is_dark=(&background == 'dark')
function! s:hi(items) abort
for [item, fg, bg, cterm, gui] in a:items
call s:HIAPI.hi(
\ {
\ 'name' : item,
\ 'ctermbg' : bg,
\ 'ctermfg' : fg,
\ 'guifg' : s:COLOR.nr2str(fg),
\ 'guibg' : s:COLOR.nr2str(bg),
\ 'cterm' : cterm,
\ 'gui' : gui,
\ }
\ )
endfor
endfunction
" color palette
let s:palette = {
\ 'dark' : [
\ ['Boolean' , 178 , '' , 'None' , 'None'] ,
\ ['Character' , 75 , '' , 'None' , 'None'] ,
\ ['ColorColumn' , '' , 236 , 'None' , 'None'] ,
\ ['Comment' , 30 , '' , 'None' , 'italic'] ,
\ ['Conditional' , 68 , '' , 'bold' , 'bold'] ,
\ ['Constant' , 218 , '' , 'None' , 'None'] ,
\ ['Cursor' , 235 , 178 , 'bold' , 'bold'] ,
\ ['CursorColumn' , '' , 236 , 'None' , 'None'] ,
\ ['CursorLine' , '' , 236 , 'None' , 'None'] ,
\ ['CursorLineNr' , 134 , 236 , 'None' , 'None'] ,
\ ['Debug' , 225 , '' , 'None' , 'None'] ,
\ ['Define' , 177 , '' , 'None' , 'None'] ,
\ ['Delimiter' , 151 , '' , 'None' , 'None'] ,
\ ['DiffAdd' , '' , 24 , 'None' , 'None'] ,
\ ['DiffChange' , 181 , 239 , 'None' , 'None'] ,
\ ['DiffDelete' , 162 , 53 , 'None' , 'None'] ,
\ ['DiffText' , '' , 102 , 'None' , 'None'] ,
\ ['Directory' , 67 , '' , 'bold' , 'bold'] ,
\ ['Error' , 160 , 235 , 'bold' , 'bold'] ,
\ ['ErrorMsg' , 196 , 235 , 'bold' , 'bold'] ,
\ ['Exception' , 204 , '' , 'bold' , 'bold'] ,
\ ['Float' , 135 , '' , 'None' , 'None'] ,
\ ['FoldColumn' , 67 , 236 , 'None' , 'None'] ,
\ ['Folded' , 133 , 236 , 'bold' , 'bold'] ,
\ ['Function' , 169 , '' , 'bold' , 'bold'] ,
\ ['Identifier' , 167 , '' , 'None' , 'None'] ,
\ ['Ignore' , 244 , '' , 'None' , 'None'] ,
\ ['IncSearch' , 16 , 76 , 'bold' , 'bold'] ,
\ ['Keyword' , 68 , '' , 'bold' , 'bold'] ,
\ ['Label' , 104 , '' , 'None' , 'None'] ,
\ ['LineNr' , 238 , 235 , 'None' , 'None'] ,
\ ['Macro' , 140 , '' , 'None' , 'None'] ,
\ ['MatchParen' , 40 , 234 , 'bold , underline' , 'bold , underline'] ,
\ ['ModeMsg' , 229 , '' , 'None' , 'None'] ,
\ ['NonText' , 241 , '' , 'None' , 'None'] ,
\ ['Normal' , 249 , 235 , 'None' , 'None'] ,
\ ['Number' , 176 , '' , 'None' , 'None'] ,
\ ['Operator' , 111 , '' , 'None' , 'None'] ,
\ ['Pmenu' , 141 , 236 , 'None' , 'None'] ,
\ ['PmenuSbar' , 28 , 233 , 'None' , 'None'] ,
\ ['PmenuSel' , 251 , 97 , 'None' , 'None'] ,
\ ['PmenuThumb' , 160 , 97 , 'None' , 'None'] ,
\ ['PreCondit' , 139 , '' , 'None' , 'None'] ,
\ ['PreProc' , 176 , '' , 'None' , 'None'] ,
\ ['Question' , 81 , '' , 'None' , 'None'] ,
\ ['Repeat' , 68 , '' , 'bold' , 'bold'] ,
\ ['Search' , 16 , 76 , 'bold' , 'bold'] ,
\ ['SignColumn' , 118 , 235 , 'None' , 'None'] ,
\ ['Special' , 169 , '' , 'None' , 'None'] ,
\ ['SpecialChar' , 171 , '' , 'bold' , 'bold'] ,
\ ['SpecialComment' , 24 , '' , 'None' , 'None'] ,
\ ['SpecialKey' , 59 , '' , 'None' , 'None'] ,
\ ['SpellBad' , 168 , '' , 'underline' , 'undercurl'] ,
\ ['SpellCap' , 110 , '' , 'underline' , 'undercurl'] ,
\ ['SpellLocal' , 253 , '' , 'underline' , 'undercurl'] ,
\ ['SpellRare' , 218 , '' , 'underline' , 'undercurl'] ,
\ ['Statement' , 68 , '' , 'None' , 'None'] ,
\ ['StatusLine' , 140 , 238 , 'None' , 'None'] ,
\ ['StatusLineNC' , 242 , 237 , 'None' , 'None'] ,
\ ['StatusLineTerm' , 140 , 238 , 'bold' , 'bold'] ,
\ ['StatusLineTermNC' , 244 , 237 , 'bold' , 'bold'] ,
\ ['StorageClass' , 178 , '' , 'bold' , 'bold'] ,
\ ['String' , 36 , '' , 'None' , 'None'] ,
\ ['Structure' , 68 , '' , 'bold' , 'bold'] ,
\ ['TabLine' , 66 , 239 , 'None' , 'None'] ,
\ ['TabLineFill' , 145 , 238 , 'None' , 'None'] ,
\ ['TabLineSel' , 178 , 240 , 'None' , 'None'] ,
\ ['Tag' , 161 , '' , 'None' , 'None'] ,
\ ['Title' , 176 , '' , 'None' , 'None'] ,
\ ['Todo' , 172 , 235 , 'bold' , 'bold'] ,
\ ['Type' , 68 , '' , 'None' , 'None'] ,
\ ['Typedef' , 68 , '' , 'None' , 'None'] ,
\ ['VertSplit' , 234 , '' , 'None' , 'None'] ,
\ ['Visual' , '' , 238 , 'None' , 'None'] ,
\ ['VisualNOS' , '' , 238 , 'None' , 'None'] ,
\ ['Warning' , 136 , '' , 'bold' , 'bold'] ,
\ ['WarningMsg' , 136 , '' , 'bold' , 'bold'] ,
\ ['WildMenu' , 214 , 239 , 'None' , 'None'] ,
\ ['VertSplit' , 235 , 238 , 'None' , 'None'] ,
\ ] ,
\ 'light' : [
\ ],
\ }
call s:hi(s:palette[s:is_dark ? 'dark' : 'light'])
if s:is_dark
set background=dark
endif

View File

@ -1,69 +1,71 @@
"=============================================================================
" init.vim --- Language && encoding in SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
scriptencoding utf-8 scriptencoding utf-8
" Enable nocompatible " Enable nocompatible
if has('vim_starting') if has('vim_starting')
if &compatible if &compatible
set nocompatible set nocompatible
endif endif
endif endif
" Fsep && Psep " Fsep && Psep
if has('win16') || has('win32') || has('win64') if has('win16') || has('win32') || has('win64')
let s:Psep = ';' let s:Psep = ';'
let s:Fsep = '\' let s:Fsep = '\'
else else
let s:Psep = ':' let s:Psep = ':'
let s:Fsep = '/' let s:Fsep = '/'
endif endif
"Use English for anything in vim "Use English for anything in vim
try try
if WINDOWS() if WINDOWS()
silent exec 'lan mes en_US.UTF-8' silent exec 'lan mes en_US.UTF-8'
elseif OSX() elseif OSX()
silent exec 'language en_US' silent exec 'language en_US'
else
let s:uname = system('uname -s')
if s:uname ==# "Darwin\n"
" in mac-terminal
silent exec 'language en_US'
elseif s:uname ==# "SunOS\n"
" in Sun-OS terminal
silent exec 'lan en_US.UTF-8'
else else
let s:uname = system('uname -s') " in linux-terminal
if s:uname ==# "Darwin\n" silent exec 'lan en_US.utf8'
" in mac-terminal
silent exec 'language en_US'
elseif s:uname ==# "SunOS\n"
" in Sun-OS terminal
silent exec 'lan en_US.UTF-8'
else
" in linux-terminal
silent exec 'lan en_US.utf8'
endif
endif endif
endif
catch /^Vim\%((\a\+)\)\=:E197/ catch /^Vim\%((\a\+)\)\=:E197/
call SpaceVim#logger#error('Can not set language to en_US.utf8') call SpaceVim#logger#error('Can not set language to en_US.utf8')
endtry endtry
" try to set encoding to utf-8 " try to set encoding to utf-8
if WINDOWS() if WINDOWS()
" Be nice and check for multi_byte even if the config requires " Be nice and check for multi_byte even if the config requires
" multi_byte support most of the time " multi_byte support most of the time
if has('multi_byte') if has('multi_byte')
" Windows cmd.exe still uses cp850. If Windows ever moved to " Windows cmd.exe still uses cp850. If Windows ever moved to
" Powershell as the primary terminal, this would be utf-8 " Powershell as the primary terminal, this would be utf-8
set termencoding=cp850 set termencoding=cp850
" Let Vim use utf-8 internally, because many scripts require this " Let Vim use utf-8 internally, because many scripts require this
set encoding=utf-8 set encoding=utf-8
setglobal fileencoding=utf-8 setglobal fileencoding=utf-8
" Windows has traditionally used cp1252, so it's probably wise to " Windows has traditionally used cp1252, so it's probably wise to
" fallback into cp1252 instead of eg. iso-8859-15. " fallback into cp1252 instead of eg. iso-8859-15.
" Newer Windows files might contain utf-8 or utf-16 LE so we might " Newer Windows files might contain utf-8 or utf-16 LE so we might
" want to try them first. " want to try them first.
set fileencodings=ucs-bom,utf-8,gbk,utf-16le,cp1252,iso-8859-15 set fileencodings=ucs-bom,utf-8,gbk,utf-16le,cp1252,iso-8859-15
endif endif
else else
" set default encoding to utf-8 " set default encoding to utf-8
set encoding=utf-8 set termencoding=utf-8
set termencoding=utf-8 set fileencoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
endif endif
" Enable 256 colors
if $COLORTERM ==# 'gnome-terminal'
set t_Co=256
endif

View File

@ -6,71 +6,20 @@
" License: GPLv3 " License: GPLv3
"============================================================================= "=============================================================================
let g:Config_Main_Home = fnamemodify(expand('<sfile>'), " Detect root directory of SpaceVim
let g:_spacevim_root_dir = fnamemodify(expand('<sfile>'),
\ ':p:h:gs?\\?'.((has('win16') || has('win32') \ ':p:h:gs?\\?'.((has('win16') || has('win32')
\ || has('win64'))?'\':'/') . '?') \ || has('win64'))?'\':'/') . '?')
lockvar g:_spacevim_root_dir
" [dir?, path]
function! s:parser_argv() abort
if !argc()
return [1, getcwd()]
elseif argv(0) =~# '/$'
let f = expand(argv(0))
if isdirectory(f)
return [1, f]
else
return [1, getcwd()]
endif
elseif argv(0) ==# '.'
return [1, getcwd()]
elseif isdirectory(expand(argv(0)))
return [1, expand(argv(0)) ]
else
return [0]
endif
endfunction
let s:status = s:parser_argv()
if s:status[0]
let g:_spacevim_enter_dir = s:status[1]
augroup SPwelcome
au!
autocmd VimEnter * call SpaceVim#welcome()
augroup END
endif
try try
call zvim#util#source_rc('functions.vim') call SpaceVim#begin()
catch catch
execute 'set rtp +=' . fnamemodify(g:Config_Main_Home, ':p:h:h') " Update the rtp only when SpaceVim is not contained in runtimepath.
call zvim#util#source_rc('functions.vim') execute 'set rtp +=' . fnamemodify(g:_spacevim_root_dir, ':p:h:h')
call SpaceVim#begin()
endtry endtry
call zvim#util#source_rc('init.vim')
call SpaceVim#default()
call SpaceVim#loadCustomConfig() call SpaceVim#loadCustomConfig()
call SpaceVim#server#connect()
call SpaceVim#end() call SpaceVim#end()
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
call zvim#util#source_rc('general.vim')
call SpaceVim#autocmds#init()
if has('nvim')
call zvim#util#source_rc('neovim.vim')
endif
call zvim#util#source_rc('commands.vim')
filetype plugin indent on
syntax on
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80:

View File

@ -15,7 +15,7 @@ elseif type(g:spacevim_force_global_config) == type([])
endif endif
if g:spacevim_force_global_config == 0 if g:spacevim_force_global_config == 0
let g:neosnippet#snippets_directory = [getcwd() . '/.Spacevim.d/snippets'] + let g:neosnippet#snippets_directory = [getcwd() . '/.SpaceVim.d/snippets'] +
\ g:neosnippet#snippets_directory \ g:neosnippet#snippets_directory
endif endif
let g:neosnippet#enable_snipmate_compatibility = let g:neosnippet#enable_snipmate_compatibility =

View File

@ -558,7 +558,7 @@ AUTOCOMPLETE *SpaceVim-autocomplete*
CODE COMPLETION CODE COMPLETION
SpaceVim uses neocomplete as the default completion engine if vim has lua SpaceVim uses neocomplete as the default completion engine if vim has lua
support. If there is no lua support, neocomplcache will be used for the support. If there is no lua support, neocomplcache will be used for the
completion engine. Spacevim uses deoplete as the default completion engine for completion engine. SpaceVim uses deoplete as the default completion engine for
neovim. Deoplete requires neovim to be compiled with python support. For more neovim. Deoplete requires neovim to be compiled with python support. For more
information on python support, please read neovim's |provider-python|. information on python support, please read neovim's |provider-python|.

View File

@ -77,6 +77,9 @@ also supports local config for each project. Place local config settings in
`.SpaceVim.d/init.vim` in the root directory of your project. `.SpaceVim.d/` `.SpaceVim.d/init.vim` in the root directory of your project. `.SpaceVim.d/`
will also be added to runtimepath. will also be added to runtimepath.
*g:spacevim_version*
Version of SpaceVim , this value can not be changed.
*g:spacevim_default_indent* *g:spacevim_default_indent*
Change the default indentation of SpaceVim. Default is 2. Change the default indentation of SpaceVim. Default is 2.
> >
@ -585,7 +588,7 @@ AUTOCOMPLETE *SpaceVim-autocomplete*
CODE COMPLETION CODE COMPLETION
SpaceVim uses neocomplete as the default completion engine if vim has lua SpaceVim uses neocomplete as the default completion engine if vim has lua
support. If there is no lua support, neocomplcache will be used for the support. If there is no lua support, neocomplcache will be used for the
completion engine. Spacevim uses deoplete as the default completion engine for completion engine. SpaceVim uses deoplete as the default completion engine for
neovim. Deoplete requires neovim to be compiled with python support. For more neovim. Deoplete requires neovim to be compiled with python support. For more
information on python support, please read neovim's |provider-python|. information on python support, please read neovim's |provider-python|.

View File

@ -11,6 +11,7 @@ description: "General contributing guidelines and changelog of SpaceVim, includi
- [Reporting issues](#reporting-issues) - [Reporting issues](#reporting-issues)
- [Contributing code](#contributing-code) - [Contributing code](#contributing-code)
- [License](#license) - [License](#license)
- [Bootstrap](#bootstrap)
- [Conventions](#conventions) - [Conventions](#conventions)
- [Pull Request](#pull-request) - [Pull Request](#pull-request)
- [Rebase your pr Branch on top of upstream master:](#rebase-your-pr-branch-on-top-of-upstream-master) - [Rebase your pr Branch on top of upstream master:](#rebase-your-pr-branch-on-top-of-upstream-master)
@ -71,6 +72,12 @@ The license is GPLv3 for all the parts of SpaceVim. this includes:
For files not belonging to SpaceVim like local packages and libraries, refer to the header file. Those files should not have an empty header, we may not accept code without a proper header file. For files not belonging to SpaceVim like local packages and libraries, refer to the header file. Those files should not have an empty header, we may not accept code without a proper header file.
### Bootstrap
Before contributing to SpaceVim, you should know how does SpaceVim bootstrap, here is the logic of the bootstrap when SpaceVim startup.
<!-- TODO -->
### Conventions ### Conventions
SpaceVim is based on conventions, mainly for naming functions, keybindings definition and writing documentation. Please read the [conventions](https://spacevim.org/conventions/) before your first contribution to get to know them. SpaceVim is based on conventions, mainly for naming functions, keybindings definition and writing documentation. Please read the [conventions](https://spacevim.org/conventions/) before your first contribution to get to know them.

View File

@ -3,4 +3,4 @@ Execute ( SpaceVim api: SpaceVim main code ):
SPInstall SPInstall
exe "func! Close() \n qa! \n endf" exe "func! Close() \n qa! \n endf"
call timer_start(2000, 'Close') call timer_start(2000, 'Close')
AssertEqual fnamemodify(g:Config_Main_Home, ':.'), 'config' AssertEqual fnamemodify(g:_spacevim_root_dir, ':.'), 'config'