1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-24 02:37:06 +08:00

Merge branch 'core_layer' into dev

This commit is contained in:
wsdjeg 2017-03-07 22:12:08 +08:00
commit dcd6479e7c
50 changed files with 2176 additions and 1729 deletions

View File

@ -2,7 +2,7 @@
" SpaceVim.vim --- Initialization and core files for SpaceVim " SpaceVim.vim --- Initialization and core files for SpaceVim
" Copyright (c) 2016-2017 Shidong Wang & Contributors " Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com > " Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://github.com/syl20bnr/spacemacs " URL: https://spacevim.org
" License: MIT license " License: MIT license
"============================================================================= "=============================================================================
@ -72,7 +72,9 @@ let g:spacevim_vim_plug_installed = 0
" > " >
" let g:spacevim_plugin_bundle_dir = '~/.cache/vimplugs' " let g:spacevim_plugin_bundle_dir = '~/.cache/vimplugs'
" < " <
let g:spacevim_plugin_bundle_dir = $HOME. join(['', '.cache', 'vimfiles', ''], SpaceVim#api#import('file').separator) let g:spacevim_plugin_bundle_dir
\ = $HOME. join(['', '.cache', 'vimfiles', ''],
\ SpaceVim#api#import('file').separator)
"" ""
" Enable/Disable realtime leader guide. Default is 0. " Enable/Disable realtime leader guide. Default is 0.
" > " >
@ -160,7 +162,7 @@ let g:spacevim_filemanager = 'vimfiler'
"" ""
" The default plugin manager of SpaceVim. Default is 'dein'. " The default plugin manager of SpaceVim. Default is 'dein'.
" Options are dein, neobundle, or vim-plug. " Options are dein, neobundle, or vim-plug.
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug let g:spacevim_plugin_manager = 'dein'
"" ""
" Enable/Disable checkinstall on SpaceVim startup. Default is 1. " Enable/Disable checkinstall on SpaceVim startup. Default is 1.
" > " >
@ -249,8 +251,10 @@ let g:spacevim_src_root = 'E:\sources\'
"" ""
" The host file url. This option is for Chinese users who can not use " The host file url. This option is for Chinese users who can not use
" Google and Twitter. " Google and Twitter.
let g:spacevim_hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts' let g:spacevim_hosts_url
let g:spacevim_wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg, \ = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
let g:spacevim_wildignore
\ = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,
\*.ttf,*.TTF,*.png,*/target/*, \*.ttf,*.TTF,*.png,*/target/*,
\.git,.svn,.hg,.DS_Store' \.git,.svn,.hg,.DS_Store'
@ -407,3 +411,7 @@ endfunction
" > " >
" Add `let mapleader = "\<space>"` to `~/.SpaceVim.d/init.vim` " Add `let mapleader = "\<space>"` to `~/.SpaceVim.d/init.vim`
" < " <
" vim:set et sw=2 cc=80:

View File

@ -6,3 +6,5 @@ function! SpaceVim#api#import(name) abort
endtry endtry
return p return p
endfunction endfunction
" vim:set fdm=marker sw=2 nowrap:

View File

@ -102,3 +102,5 @@ let s:json['json_encode'] = function('s:json_encode')
function! SpaceVim#api#data#json#get() abort function! SpaceVim#api#data#json#get() abort
return deepcopy(s:json) return deepcopy(s:json)
endfunction endfunction
" vim:set et sw=2:

View File

@ -42,5 +42,4 @@ function! SpaceVim#api#data#string#get() abort
return deepcopy(s:file) return deepcopy(s:file)
endfunction endfunction
" vim:set et sw=2:

View File

@ -179,5 +179,4 @@ function! SpaceVim#api#file#get() abort
return deepcopy(s:file) return deepcopy(s:file)
endfunction endfunction
" vim:set et sw=2:

View File

@ -106,3 +106,4 @@ function! SpaceVim#api#messletters#get() abort
return deepcopy(s:chars) return deepcopy(s:chars)
endfunction endfunction
" vim:set et sw=2:

View File

@ -57,3 +57,5 @@ let s:system['fileformat'] = function('s:fileformat')
function! SpaceVim#api#system#get() abort function! SpaceVim#api#system#get() abort
return deepcopy(s:system) return deepcopy(s:system)
endfunction endfunction
" vim:set et sw=2:

View File

@ -79,3 +79,5 @@ let s:box['drawing_table'] = function('s:drawing_table')
function! SpaceVim#api#unicode#box#get() abort function! SpaceVim#api#unicode#box#get() abort
return deepcopy(s:box) return deepcopy(s:box)
endfunction endfunction
" vim:set et sw=2:

View File

@ -95,3 +95,5 @@ function! s:generate_doc() abort
call system('vimdoc .') call system('vimdoc .')
endif endif
endfunction endfunction
" vim:set et sw=2:

View File

@ -81,21 +81,25 @@ function! SpaceVim#default#SetOptions() abort
set undodir=$HOME/.data/undofile set undodir=$HOME/.data/undofile
set backupdir=$HOME/.data/backup set backupdir=$HOME/.data/backup
set directory=$HOME/.data/swap set directory=$HOME/.data/swap
set nofoldenable " no fold enable
" no fold enable
set nofoldenable
set nowritebackup set nowritebackup
set matchtime=0 set matchtime=0
set ruler set ruler
set showmatch set showmatch
set showmode set showmode
"menuone: show the pupmenu when only one match "menuone: show the pupmenu when only one match
set completeopt=menu,menuone,longest " disable preview scratch window, " disable preview scratch window,
set complete=.,w,b,u,t " h: 'complete' set completeopt=menu,menuone,longest
set pumheight=15 " limit completion menu height " h: 'complete'
set complete=.,w,b,u,t
" limit completion menu height
set pumheight=15
set scrolloff=7 set scrolloff=7
set incsearch set incsearch
set hlsearch set hlsearch
set laststatus=2 set laststatus=2
set completeopt=longest,menu
set wildignorecase set wildignorecase
set mouse= set mouse=
set hidden set hidden
@ -154,8 +158,6 @@ endfunction
function! SpaceVim#default#SetMappings() abort function! SpaceVim#default#SetMappings() abort
"mapping "mapping
"全局映射
"也可以通过'za'打开或者关闭折叠
imap <silent><expr><TAB> SpaceVim#mapping#tab() imap <silent><expr><TAB> SpaceVim#mapping#tab()
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
inoremap <silent><expr><CR> SpaceVim#mapping#enter() inoremap <silent><expr><CR> SpaceVim#mapping#enter()
@ -165,16 +167,12 @@ function! SpaceVim#default#SetMappings() abort
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : "" imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : "" smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
"Super paste it does not work
"ino <C-v> <esc>:set paste<cr>mui<C-R>+<esc>mv'uV'v=:set nopaste<cr>
"对于没有权限的文件使用 :w!!来保存
cnoremap w!! %!sudo tee > /dev/null %
" cmap W!! w !sudo tee % >/dev/null " I can not understand
" Save a file with sudo " Save a file with sudo
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN " http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
cnoremap w!! %!sudo tee > /dev/null %
" 映射Ctrl+上下左右来切换窗口 " Use Ctrl+* to jump between windows
nnoremap <silent><C-Right> :<C-u>wincmd l<CR> nnoremap <silent><C-Right> :<C-u>wincmd l<CR>
nnoremap <silent><C-Left> :<C-u>wincmd h<CR> nnoremap <silent><C-Left> :<C-u>wincmd h<CR>
nnoremap <silent><C-Up> :<C-u>wincmd k<CR> nnoremap <silent><C-Up> :<C-u>wincmd k<CR>
@ -193,7 +191,7 @@ function! SpaceVim#default#SetMappings() abort
nnoremap <silent>[<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr> nnoremap <silent>[<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
nnoremap <silent>]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr> nnoremap <silent>]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
"Use jk switch to normal model "Use jk switch to normal mode
inoremap jk <esc> inoremap jk <esc>
"]e or [e move current line ,count can be useed "]e or [e move current line ,count can be useed
@ -207,12 +205,11 @@ function! SpaceVim#default#SetMappings() abort
vnoremap <silent>]<Home> dggP`` vnoremap <silent>]<Home> dggP``
"Ctrl+Shift+上下移动当前行 "Ctrl+Shift+Up/Down to move up and down
nnoremap <silent><C-S-Down> :m .+1<CR>== nnoremap <silent><C-S-Down> :m .+1<CR>==
nnoremap <silent><C-S-Up> :m .-2<CR>== nnoremap <silent><C-S-Up> :m .-2<CR>==
inoremap <silent><C-S-Down> <Esc>:m .+1<CR>==gi inoremap <silent><C-S-Down> <Esc>:m .+1<CR>==gi
inoremap <silent><C-S-Up> <Esc>:m .-2<CR>==gi inoremap <silent><C-S-Up> <Esc>:m .-2<CR>==gi
"上下移动选中的行
vnoremap <silent><C-S-Down> :m '>+1<CR>gv=gv vnoremap <silent><C-S-Down> :m '>+1<CR>gv=gv
vnoremap <silent><C-S-Up> :m '<-2<CR>gv=gv vnoremap <silent><C-S-Up> :m '<-2<CR>gv=gv
" download gvimfullscreen.dll from github, copy gvimfullscreen.dll to " download gvimfullscreen.dll from github, copy gvimfullscreen.dll to
@ -336,3 +333,5 @@ endf
function! SpaceVim#default#UseSimpleMode() abort function! SpaceVim#default#UseSimpleMode() abort
endfunction endfunction
" vim:set et sw=2:

View File

@ -16,3 +16,5 @@ function! SpaceVim#health#report() abort
endfor endfor
return join(report, "\n") return join(report, "\n")
endfunction endfunction
" vim:set et sw=2:

View File

@ -22,3 +22,5 @@ function! SpaceVim#health#clipboard#check() abort
return result return result
endfunction endfunction
" vim:set et sw=2:

View File

@ -16,3 +16,5 @@ function! SpaceVim#health#lua#check() abort
endif endif
return result return result
endfunction endfunction
" vim:set et sw=2:

View File

@ -39,3 +39,5 @@ function! SpaceVim#health#python#check() abort
endif endif
return result return result
endfunction endfunction
" vim:set et sw=2:

View File

@ -10,3 +10,5 @@ function! SpaceVim#layers#load(layer) abort
call add(g:spacevim_plugin_groups, a:layer) call add(g:spacevim_plugin_groups, a:layer)
endif endif
endfunction endfunction
" vim:set et sw=2:

View File

View File

@ -0,0 +1,41 @@
let g:spacevim_statusline_mode_format = {
\ 'n' : 'NORMAL',
\ 'i' : 'INSERT',
\ 'v' : 'VISUAL',
\ }
"""""""""""""""""""""""""""""""""
function! s:mode() abort
let mt = g:spacevim_statusline_mode_format
let m = mode()
return mt[m]
endfunction
function! s:filetype() abort
return &filetype
endfunction
function! s:encoding() abort
return &encoding
endfunction
function! s:tabname() abort
return '1'
endfunction
function! SpaceVim#layers#core#statusline#get() abort
return join([
\ s:mode(),
\ s:tabname(),
\ s:encoding(),
\ s:filetype()
\ ], ' ')
return s:mode() . s:tabname()
endfunction
function! s:refresh() abort
endfunction
set statusline=%!SpaceVim#layers#core#statusline#get()

View File

@ -0,0 +1,59 @@
"=============================================================================
" tabline.vim --- core#tabline Layer file for SpaceVim
" Copyright (c) 2012-2016 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
""
" @section core#tabline, layer-core-tabline
" @parentsection layers
" This layer provides default tabline for SpaceVim
let s:messletters = SpaceVim#api#import('messletters')
let s:file = SpaceVim#api#import('file')
function! s:tabname(id) abort
let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
let fn = fnamemodify(bufname(a:id), ':t')
if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(fn)
if !empty(icon)
let fn = icon . ' ' . fn
endif
endif
if empty(fn)
return 'No Name'
else
return id . fn
endif
endfunction
function! SpaceVim#layers#core#tabline#get() abort
let t = ' '
let nr = tabpagenr()
" if nr > 1
for i in range(1, nr)
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
let id = s:messletters.bubble_num(i, g:spacevim_buffer_index_type)
let icon = s:file.fticon(name)
if !empty(icon)
let name = icon . ' ' . name
endif
let t .= id . ' ' . name
if i == nr
let t .= '%#TabLineSel#'
else
let t .= '%#TabLine# | '
endif
endfor
let t .= '%#TabLineFill#%T'
return t
endfunction
function! SpaceVim#layers#core#tabline#config() abort
set tabline=%!SpaceVim#layers#core#tabline#get()
endfunction

View File

@ -63,10 +63,15 @@ function! SpaceVim#logger#viewLog(...) abort
let l = a:0 > 0 ? a:1 : 1 let l = a:0 > 0 ? a:1 : 1
if filereadable(s:logger_file) if filereadable(s:logger_file)
let logs = readfile(s:logger_file, '') let logs = readfile(s:logger_file, '')
let info .= join(filter(logs, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n") let info .= join(filter(logs,
\ "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \["
\ . s:levels[l] . "\]'"), "\n")
else else
let info .= '[ SpaceVim ] : logger file ' . s:logger_file . ' does not exists, only log for current process will be shown!' let info .= '[ SpaceVim ] : logger file ' . s:logger_file
let info .= join(filter(s:log_temp, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n") \ . ' does not exists, only log for current process will be shown!'
let info .= join(filter(s:log_temp,
\ "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \["
\ . s:levels[l] . "\]'"), "\n")
endif endif
let info .= "\n```\n" let info .= "\n```\n"
return info return info
@ -90,3 +95,5 @@ function! SpaceVim#logger#echoWarn(msg) abort
echom s:warpMsg(a:msg, 1) echom s:warpMsg(a:msg, 1)
echohl None echohl None
endfunction endfunction
" vim:set et sw=2 cc=80:

View File

@ -96,3 +96,5 @@ function! SpaceVim#mapping#vertical_split_previous_buffer() abort
e# e#
endif endif
endfunction endfunction
" vim:set et sw=2:

View File

@ -23,3 +23,5 @@ function! s:execute(cmd) abort
redir END redir END
return split(output, "\n") return split(output, "\n")
endfunction endfunction
" vim:set et sw=2:

View File

@ -62,3 +62,4 @@ function! SpaceVim#plugins#get(...) abort
endfunction endfunction
" vim:set et sw=2:

View File

@ -11,3 +11,5 @@ function! SpaceVim#util#echoWarn(msg) abort
echo a:msg echo a:msg
echohl None echohl None
endfunction endfunction
" vim:set et sw=2 cc=80:

View File

@ -17,3 +17,6 @@ function! airline#extensions#tabline#formatters#spacevim#format(bufnr, buffers)
endif endif
endfunction endfunction
" @vimlint(EVL103, 0, a:buffers) " @vimlint(EVL103, 0, a:buffers)
" vim:set et sw=2:

View File

@ -97,7 +97,7 @@ function! s:git_state_to_name(symb) abort
return 'Ignored' return 'Ignored'
else else
return 'Unknown' return 'Unknown'
endif endif
endfunction endfunction
@ -135,4 +135,4 @@ endfunction
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" vim: foldmethod=marker " vim:set et sw=2:

View File

@ -105,3 +105,5 @@ function! s:search_line(path, term) abort "{{{
endif endif
return 0 return 0
endfunction "}}} endfunction "}}}
" vim:set et sw=2:

View File

@ -52,3 +52,5 @@ augroup Fix_command_in_help_buffer
autocmd FileType help exec 'nnoremap <buffer><silent><c-p> :<c-u>CtrlP ' . getcwd() .'<cr>' autocmd FileType help exec 'nnoremap <buffer><silent><c-p> :<c-u>CtrlP ' . getcwd() .'<cr>'
au FileType help exec "nnoremap <silent><buffer> q :q<CR>" au FileType help exec "nnoremap <silent><buffer> q :q<CR>"
augroup END augroup END
" vim:set et sw=2:

View File

@ -2,3 +2,5 @@ let g:deoplete#sources#clang#libclang_path =
\ get(g:, 'deoplete#sources#clang#libclang_path', '/usr/lib/libclang.so') \ get(g:, 'deoplete#sources#clang#libclang_path', '/usr/lib/libclang.so')
let g:deoplete#sources#clang#clang_header = let g:deoplete#sources#clang#clang_header =
\ get(g:, 'deoplete#sources#clang#clang_header', '/usr/lib/clang/') \ get(g:, 'deoplete#sources#clang#clang_header', '/usr/lib/clang/')
" vim:set et sw=2:

View File

@ -68,3 +68,5 @@ let g:deoplete#ignore_sources._ = ['around']
inoremap <expr><C-h> deoplete#mappings#smart_close_popup()."\<C-h>" inoremap <expr><C-h> deoplete#mappings#smart_close_popup()."\<C-h>"
inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>" inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>"
set isfname-== set isfname-==
" vim:set et sw=2:

View File

@ -24,3 +24,5 @@ augroup goyo_map
autocmd! User GoyoEnter nested call <SID>goyo_enter() autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave() autocmd! User GoyoLeave nested call <SID>goyo_leave()
augroup END augroup END
" vim:set et sw=2:

View File

@ -17,3 +17,5 @@ let g:javagetset_getterTemplate =
\ "%modifiers% %type% %funcname%(){\n" . \ "%modifiers% %type% %funcname%(){\n" .
\ " return %varname%;\n" . \ " return %varname%;\n" .
\ "}" \ "}"
" vim:set et sw=2:

View File

@ -82,3 +82,5 @@ let g:neocomplcache_vim_completefuncs = {
\ 'VimFiler' : 'vimfiler#complete', \ 'VimFiler' : 'vimfiler#complete',
\ 'Vinarise' : 'vinarise#complete', \ 'Vinarise' : 'vinarise#complete',
\} \}
" vim:set et sw=2:

View File

@ -45,3 +45,5 @@ inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup() inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup() inoremap <expr><C-e> neocomplete#cancel_popup()
" vim:set et sw=2:

View File

@ -10,3 +10,4 @@ let g:neomake_warning_sign = {
\ 'text': get(g:,'spacevim_warning_symbol', '➤'), \ 'text': get(g:,'spacevim_warning_symbol', '➤'),
\ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxYellowSign' : 'todo'), \ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxYellowSign' : 'todo'),
\ } \ }
" vim:set et sw=2:

View File

@ -31,3 +31,5 @@ function! s:my_complete_done() abort "{{{
call neosnippet#view#_insert(snippet, {}, cur_text, col) call neosnippet#view#_insert(snippet, {}, cur_text, col)
endif endif
endfunction"}}} endfunction"}}}
" vim:set et sw=2:

View File

@ -16,3 +16,5 @@ let g:syntastic_vimlint_options = {
\'EVL205': 1 , \'EVL205': 1 ,
\'EVL105': 1 , \'EVL105': 1 ,
\} \}
" vim:set et sw=2:

View File

@ -9,3 +9,5 @@ let g:Tlist_Show_One_File=0
let g:Tlist_File_Fold_Auto_Close=1 let g:Tlist_File_Fold_Auto_Close=1
let g:Tlist_Exit_OnlyWindow=1 let g:Tlist_Exit_OnlyWindow=1
let g:Tlist_Show_Menu=1 let g:Tlist_Show_Menu=1
" vim:set et sw=2:

View File

@ -7,3 +7,5 @@ vnoremap <leader>gd <ESC>:execute 'Unite -auto-preview -start-insert -no-split g
let g:unite_source_gtags_project_config = { let g:unite_source_gtags_project_config = {
\ '_': { 'treelize': 0 } \ '_': { 'treelize': 0 }
\ } \ }
" vim:set et sw=2:

View File

@ -286,3 +286,5 @@ function! s:unite_my_settings()
" Runs "split" action by <C-s>. " Runs "split" action by <C-s>.
imap <silent><buffer><expr> <C-s> unite#do_action('split') imap <silent><buffer><expr> <C-s> unite#do_action('split')
endfunction endfunction
" vim:set et sw=2:

View File

@ -83,3 +83,5 @@ if g:spacevim_enable_os_fileformat_icon
let s:sys = SpaceVim#api#import('system') let s:sys = SpaceVim#api#import('system')
let g:airline_section_y = " %{&fenc . ' ' . SpaceVim#api#import('system').fileformat()} " let g:airline_section_y = " %{&fenc . ' ' . SpaceVim#api#import('system').fileformat()} "
endif endif
" vim:set et sw=2:

View File

@ -32,3 +32,5 @@ nnoremap <Leader>re :<C-u>Ref webdict ej<Space>
nnoremap <Leader>rc :<C-u>Ref webdict cn<Space> nnoremap <Leader>rc :<C-u>Ref webdict cn<Space>
nnoremap <Leader>rw :<C-u>Ref webdict wikipedia:en<Space> nnoremap <Leader>rw :<C-u>Ref webdict wikipedia:en<Space>
nnoremap <Leader>rb :<C-u>Ref webdict bing<Space> nnoremap <Leader>rb :<C-u>Ref webdict bing<Space>
" vim:set et sw=2:

View File

@ -51,3 +51,5 @@ augroup startify_map
autocmd FileType startify call <SID>startify_mapping() autocmd FileType startify call <SID>startify_mapping()
autocmd FileType startify set scrolloff=0 autocmd FileType startify set scrolloff=0
augroup END augroup END
" vim:set et sw=2:

View File

@ -76,3 +76,5 @@ function! s:vimfilerinit()
nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window) nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window)
nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen) nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen)
endf endf
" vim:set et sw=2:

View File

@ -24,22 +24,23 @@ CONTENTS *SpaceVim-contents*
2. autocomplete..................................|SpaceVim-autocomplete| 2. autocomplete..................................|SpaceVim-autocomplete|
3. checkers....................................|SpaceVim-layer-checkers| 3. checkers....................................|SpaceVim-layer-checkers|
4. colorscheme....................................|SpaceVim-colorscheme| 4. colorscheme....................................|SpaceVim-colorscheme|
5. exprfold....................................|SpaceVim-layer-exprfold| 5. core#tabline............................|SpaceVim-layer-core-tabline|
6. incsearch..................................|SpaceVim-layer-incsearch| 6. exprfold....................................|SpaceVim-layer-exprfold|
7. indentmove................................|SpaceVim-layer-indentmove| 7. incsearch..................................|SpaceVim-layer-incsearch|
8. lang#c........................................|SpaceVim-layer-lang-c| 8. indentmove................................|SpaceVim-layer-indentmove|
9. lang#elixir..............................|SpaceVim-layer-lang-elixir| 9. lang#c........................................|SpaceVim-layer-lang-c|
10. lang#go.....................................|SpaceVim-layer-lang-go| 10. lang#elixir.............................|SpaceVim-layer-lang-elixir|
11. lang#java.................................|SpaceVim-layer-lang-java| 11. lang#go.....................................|SpaceVim-layer-lang-go|
12. lang#ocaml...............................|SpaceVim-layer-lang-ocaml| 12. lang#java.................................|SpaceVim-layer-lang-java|
13. lang#php...................................|SpaceVim-layer-lang-php| 13. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
14. lang#puppet.............................|SpaceVim-layer-lang-puppet| 14. lang#php...................................|SpaceVim-layer-lang-php|
15. lang#python.............................|SpaceVim-layer-lang-python| 15. lang#puppet.............................|SpaceVim-layer-lang-puppet|
16. lang#rust.................................|SpaceVim-layer-lang-rust| 16. lang#python.............................|SpaceVim-layer-lang-python|
17. lang#xml...................................|SpaceVim-layer-lang-xml| 17. lang#rust.................................|SpaceVim-layer-lang-rust|
18. operator...................................|SpaceVim-layer-operator| 18. lang#xml...................................|SpaceVim-layer-lang-xml|
19. shell.........................................|SpaceVim-layer-shell| 19. operator...................................|SpaceVim-layer-operator|
20. tmux...........................................|SpaceVim-layer-tmux| 20. shell.........................................|SpaceVim-layer-shell|
21. tmux...........................................|SpaceVim-layer-tmux|
5. FAQ........................................................|SpaceVim-faq| 5. FAQ........................................................|SpaceVim-faq|
============================================================================== ==============================================================================
@ -458,6 +459,11 @@ https://github.com/SpaceVim/SpaceVim/issues/209#issuecomment-280545818
zellner zellner
< <
==============================================================================
CORE#TABLINE *SpaceVim-layer-core-tabline*
This layer provides default tabline for SpaceVim
============================================================================== ==============================================================================
EXPRFOLD *SpaceVim-layer-exprfold* EXPRFOLD *SpaceVim-layer-exprfold*

View File

@ -0,0 +1,227 @@
---
title: "Conventions"
permalink: "/conventions"
---
# Conventions
## Content
- [viml coding style guild](#viml-coding-style-guide)
## Viml coding style guide
### Portability
Vim is highly configurable. Users can change many of the default settings, including the case sensitivity, the regular expression rules, the substitution rules, and more. In order for your vimscript to work for all users, follow these guidelines:
#### Strings
**Prefer single quoted strings**
Double quoted strings are semantically different in vimscript, and you probably don't want them (they break regexes).
Use double quoted strings when you need an escape sequence (such as "\n") or if you know it doesn't matter and you need to embed single quotes.
#### Matching Strings
**Use the =~# or =~? operator families over the =~ family.**
The matching behavior depends upon the user's ignorecase and smartcase settings and on whether you compare them with the =~, =~#, or =~? family of operators. Use the =~# and =~? operator families explicitly when comparing strings unless you explicitly need to honor the user's case sensitivity settings.
#### Regular Expressions
**Prefix all regexes with one of \m, \v, \M, or \V.**
In addition to the case sensitivity settings, regex behavior depends upon the user's nomagic setting. To make regexes act like nomagic and noignorecase are set, prepend all regexes with one of \m, \v, \M, or \V.
You are welcome to use other magic levels (\v) and case sensitivities (\c) so long as they are intentional and explicit.
#### Dangerous commands
**Avoid commands with unintended side effects.**
Avoid using :s[ubstitute] as it moves the cursor and prints error messages. Prefer functions (such as search()) better suited to scripts.
The meaning of the g flag depends upon the gdefault setting. If you do use :substitute you must save gdefault, set it to 0 or 1, perform the substitution, and then restore it.
For many vim commands, functions exist that do the same thing with fewer side effects. See :help functions() for a list of built-in functions.
#### Fragile commands
**Avoid commands that rely on user settings.**
Always use normal! instead of normal. The latter depends upon the user's key mappings and could do anything.
Avoid :s[ubstitute], as its behavior depends upon a number of local settings.
The same applies to other commands not listed here.
#### Catching Exceptions
**Match error codes, not error text.**
Error text may be locale dependant.
### General Guidelines
#### Messaging
**Message the user infrequently.**
Loud scripts are annoying. Message the user only when:
- A long-running process has kicked off.
- An error has occurred.
#### Type checking
**Use strict and explicit checks where possible.**
Vimscript has unsafe, unintuitive behavior when dealing with some types. For instance, 0 == 'foo' evaluates to true.
Use strict comparison operators where possible. When comparing against a string literal, use the is# operator. Otherwise, prefer maktaba#value#IsEqual or check type() explicitly.
Check variable types explicitly before using them. Use functions from maktaba#ensure, or check maktaba#value or type() and throw your own errors.
Use :unlet for variables that may change types, particularly those assigned inside loops.
#### Python
**Use sparingly.**
Use python only when it provides critical functionality, for example when writing threaded code.
#### Other Languages
**Use vimscript instead.**
Avoid using other scripting languages such as ruby and lua. We can not guarantee that the end user's vim has been compiled with support for non-vimscript languages.
#### Plugin layout
**Organize functionality into modular plugins**
Group your functionality as a plugin, unified in one directory (or code repository) which shares your plugin's name (with a "vim-" prefix or ".vim" suffix if desired). It should be split into plugin/, autoload/, etc. subdirectories as necessary, and it should declare metadata in the addon-info.json format (see the VAM documentation for details).
#### Functions
**In the autoload/ directory, defined with [!] and [abort].**
Autoloading allows functions to be loaded on demand, which makes startuptime faster and enforces function namespacing.
Script-local functions are welcome, but should also live in autoload/ and be called by autoloaded functions.
Non-library plugins should expose commands instead of functions. Command logic should be extracted into functions and autoloaded.
[!] allows developers to reload their functions without complaint.
[abort] forces the function to halt when it encounters an error.
#### Commands
**In the plugin/commands.vim or under the ftplugin/ directory, defined without [!].**
General commands go in plugin/commands.vim. Filetype-specific commands go in ftplugin/.
Excluding [!] prevents your plugin from silently clobbering existing commands. Command conflicts should be resolved by the user.
#### Autocommands
**Place them in plugin/autocmds.vim, within augroups.**
Place all autocommands in augroups.
The augroup name should be unique. It should either be, or be prefixed with, the plugin name.
Clear the augroup with autocmd! before defining new autocommands in the augroup. This makes your plugin re-entrable.
#### Mappings
**Place them in plugin/mappings.vim, using maktaba#plugin#MapPrefix to get a prefix.**
All key mappings should be defined in plugin/mappings.vim.
Partial mappings (see :help using-<Plug>.) should be defined in plugin/plugs.vim.
**Always use the noremap family of commands.**
Your plugins generally shouldn't introduce mappings, but if they do, the map command respects the users existing mappings and could do anything.
#### Errors
When using catch, match the error code rather than the error text.
#### Settings
**Change settings locally**
Use :setlocal and &l: instead of :set and & unless you have explicit reason to do otherwise.
### Style
Follow google style conventions. When in doubt, treat vimscript style like python style.
#### Whitespace
**Similar to python.**
- Use two spaces for indents
- Do not use tabs
- Use spaces around operators
This does not apply to arguments to commands.
let s:variable = "concatenated " . "strings"
command -range=% MyCommand
- Do not introduce trailing whitespace
You need not go out of your way to remove it.
Trailing whitespace is allowed in mappings which prep commands for user input, such as "noremap <leader>gf :grep -f ".
- Restrict lines to 80 columns wide
- Indent continued lines by four spaces
- Do not align arguments of commands
```diff
+command -bang MyCommand call myplugin#foo()
+command MyCommand2 call myplugin#bar()
-command -bang MyCommand call myplugin#foo()
-command MyCommand2 call myplugin#bar()
```
#### Line Continuations
- Prefer line continuations on semantic boundaries.
```diff
+command SomeLongCommand
+ \ call some#function()
-command SomeLongCommand call
- \ some#function()
```
- Place one space after the backslash denoting a line continuation.
When continuing a multi-line command a pipe can be substituted for this space as necessary, as follows:
```viml
autocommand BufEnter <buffer>
\ if !empty(s:var)
\| call some#function()
\|else
\| call some#function(s:var)
\|endif
```
- Do not continue multi-line commands when you can avoid it. Prefer function calls.
#### Naming
In general, use plugin-names-like-this, FunctionNamesLikeThis, CommandNamesLikeThis, augroup_names_like_this, variable_names_like_this.
Always prefix variables with their scope.
- plugin-names-like-this
Keep them short and sweet.
- FunctionNamesLikeThis
- Prefix script-local functions with s:
- Autoloaded functions may not have a scope prefix.
- Do not create global functions. Use autoloaded functions instead.
- CommandNamesLikeThis
Prefer succinct command names over common command prefixes.
- variable_names_like_this
Augroup names count as variables for naming purposes.
- Prefix all variables with their scope.
- Global variables with g:
- Script-local variables with s:
- Function arguments with a:
- Function-local variables with l:
- Vim-predefined variables with v:
- Buffer-local variables with b:
- g:, s:, and a: must always be used.
- b: changes the variable semantics; use it when you want buffer-local semantics.
- l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but dont go out of your way to add them elsewhere.
## Thanks:
- link : https://google.github.io/styleguide/vimscriptguide.xml
- link : https://google.github.io/styleguide/vimscriptfull.xml
- link : https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt

View File

@ -483,23 +483,55 @@ in the root of your project. `.SpaceVim.d/` will also be added into runtimepath.
here is an example config file for SpaceVim: here is an example config file for SpaceVim:
```viml ```vim
" set the options of SpaceVim " Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim
let g:spacevim_colorscheme = 'solarized' " file for all possible options:
let g:spacevim_default_indent = 3
let g:spacevim_max_column = 80
" setting layers, load 'lang#java' layer. " Change the default directory where all miscellaneous persistent files go.
call SpaceVim#layers#load('lang#java') " By default it is ~/.cache/vimfiles.
let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles'
" add custom plugins. " set SpaceVim colorscheme
let g:spacevim_colorscheme = 'jellybeans'
" Set plugin manager, you want to use, default is dein.vim
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
" use space as `<Leader>`
let mapleader = "\<space>"
" Set windows shortcut leader [Window], default is `s`
let g:spacevim_windows_leader = 's'
" Set unite work flow shortcut leader [Unite], default is `f`
let g:spacevim_unite_leader = 'f'
" By default, language specific plugins are not loaded. This can be changed
" with the following, then the plugins for go development will be loaded.
call SpaceVim#layers#load('lang#go')
" loaded ui layer
call SpaceVim#layers#load('ui')
" If there is a particular plugin you don't like, you can define this
" variable to disable them entirely:
let g:spacevim_disabled_plugins=[
\ ['junegunn/fzf.vim'],
\ ]
" If you want to add some custom plugins, use these options:
let g:spacevim_custom_plugins = [ let g:spacevim_custom_plugins = [
\ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}], \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
\ ['wsdjeg/GitHub.vim'], \ ['wsdjeg/GitHub.vim'],
\ ] \ ]
" custom mappings: " set the guifont
nnoremap <c-l> :Ydc<cr> let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'
``` ```
Comprehensive documentation is available for each layer by <kbd>:h SpaceVim</kbd>.
<!-- plublic links --> <!-- plublic links -->
[dein.vim]: https://github.com/Shougo/dein.vim [dein.vim]: https://github.com/Shougo/dein.vim

View File

@ -0,0 +1 @@
" vim:set et sw=2

View File

@ -1,4 +1,6 @@
if exists("g:GuiLoaded") if exists('g:GuiLoaded')
exe 'Guifont! DejaVu Sans Mono for Powerline:h11:cANSI:qDRAFT' exe 'Guifont! DejaVu Sans Mono for Powerline:h11:cANSI:qDRAFT'
endif endif
" vim:set et sw=2:

1
vimrc
View File

@ -2,3 +2,4 @@
if 1 if 1
execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/main.vim' execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/main.vim'
endif endif
" vim:set et sw=2