1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-15 19:45:46 +08:00

Merge branch 'dev' into signatures

This commit is contained in:
wsdjeg 2017-12-09 22:18:41 +08:00
commit 557d14eb9c
68 changed files with 2338 additions and 1514 deletions

View File

@ -11,8 +11,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \ docker run -it --rm \
-v $PWD/.ci:/.ci \ -v $PWD/.ci:/.ci \
-v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
-v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \ -v $PWD/build:/build \
spacevim/vims neovim-stable -u .ci/common/github_commenter.vim spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
rm build_log rm build_log
fi fi
elif [ "$LINT" = "vint-errors" ] ; then elif [ "$LINT" = "vint-errors" ] ; then
@ -25,8 +27,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \ docker run -it --rm \
-v $PWD/.ci:/.ci \ -v $PWD/.ci:/.ci \
-v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
-v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \ -v $PWD/build:/build \
spacevim/vims neovim-stable -u .ci/common/github_commenter.vim spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
rm build_log rm build_log
fi fi
elif [ "$LINT" = "vader" ] ; then elif [ "$LINT" = "vader" ] ; then

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
if [ "$LINT" = "vimlint-errors" ] ; then
VIMLINT_LOG=""
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \
-v $PWD/.ci:/.ci \
-v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
-v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \
spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
elif [ "$LINT" = "vint-errors" ] ; then
VIMLINT_LOG=""
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \
-v $PWD/.ci:/.ci \
-v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
-v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \
spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
elif [ "$LINT" = "vader" ] ; then
echo ""
fi
fi

View File

@ -1,8 +1,10 @@
exe 'set nocp' exe 'set nocp'
set rtp+=build/GitHub.vim set rtp+=build/GitHub.vim
set rtp+=/API/
so build/GitHub.vim/plugin/github.vim so build/GitHub.vim/plugin/github.vim
so build/GitHub.vim/autoload/github/api/issues.vim so build/GitHub.vim/autoload/github/api/issues.vim
so build/GitHub.vim/autoload/github/api/util.vim so build/GitHub.vim/autoload/github/api/util.vim
let s:LIST = SpaceVim#api#import('data#list')
let s:log = filereadable('build_log') ? system('cat build_log') : '' let s:log = filereadable('build_log') ? system('cat build_log') : ''
function! s:update_log(log, summary, new_log) abort function! s:update_log(log, summary, new_log) abort
let log = split(a:log, "\n") let log = split(a:log, "\n")
@ -16,7 +18,11 @@ function! s:update_log(log, summary, new_log) abort
let end = i let end = i
endif endif
endfor endfor
return a:log . "\n" . a:new_log if begin != -1 && end != -1
return s:LIST.replace(log, begin, end, split(a:new_log, "\n"))
else
return a:log . "\n" . a:new_log
endif
endfunction endfunction
if !empty(s:log) if !empty(s:log)
@ -44,5 +50,26 @@ if !empty(s:log)
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET) \ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
endif endif
endif endif
else
if $LINT == 'vader'
let s:summary = $VIM . ' ' . $LINT . ' build log'
else
let s:summary = $LINT . ' build log'
endif
let s:log = '<details><summary>' . s:summary . "</summary>\n" . s:log . "\n</details>"
let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'')
if !empty(s:comments)
let s:nr = 0
for s:comment in s:comments
if s:comment.user.login ==# 'SpaceVimBot'
let s:nr = s:comment.id
break
endif
endfor
if s:nr != 0
call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr,
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
endif
endif
endif endif
quit quit

View File

@ -20,7 +20,7 @@ SpaceVim is a community-driven vim distribution that supports vim and Neovim. S
Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either! Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either!
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) ![welcome-page](https://user-images.githubusercontent.com/13142418/33793078-3446cb6e-dc76-11e7-9998-376a355557a4.png)
See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information.

View File

@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow'
" \ 'version control info' " \ 'version control info'
" \ ] " \ ]
" < " <
let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'minor mode lighters', 'version control info'] let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info', 'hunks']
"" ""
" Define the right section of statusline in active windows. By default: " Define the right section of statusline in active windows. By default:
" > " >

View File

@ -7,7 +7,7 @@ let s:COP = SpaceVim#api#import('vim#compatible')
" this is for vim command completion " this is for vim command completion
function! s:self.complete(ArgLead, CmdLine, CursorPos) abort function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$' if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine) return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif endif
let result = s:COP.systemlist([s:completer, a:CmdLine]) let result = s:COP.systemlist([s:completer, a:CmdLine])
@ -18,7 +18,7 @@ endfunction
" this is for vim input() " this is for vim input()
function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$' if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine) return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif endif
let result = s:COP.systemlist([s:completer, a:CmdLine]) let result = s:COP.systemlist([s:completer, a:CmdLine])

View File

@ -10,6 +10,7 @@ function! SpaceVim#api#data#list#get() abort
\ 'has' : '', \ 'has' : '',
\ 'has_index' : '', \ 'has_index' : '',
\ 'listpart' : '', \ 'listpart' : '',
\ 'replace' : '',
\ }, \ },
\ "function('s:' . v:key)" \ "function('s:' . v:key)"
\ ) \ )
@ -101,4 +102,12 @@ function! s:has_index(list, index) abort
return 0 <= a:index && a:index < len(a:list) return 0 <= a:index && a:index < len(a:list)
endfunction endfunction
function! s:replace(list, begin, end, re_list)
if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list)
return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:]
else
return a:list
endif
endf
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80:

View File

@ -120,7 +120,6 @@ function! s:self._update_content() abort
if type(key.key) == 1 " is a string if type(key.key) == 1 " is a string
let right_max_key_len = max([len(key.key), right_max_key_len]) let right_max_key_len = max([len(key.key), right_max_key_len])
elseif type(key.key) == 3 " is a list elseif type(key.key) == 3 " is a list
let g:wsd = key.key
let right_max_key_len = max([len(join(key.key, '/')), right_max_key_len]) let right_max_key_len = max([len(join(key.key, '/')), right_max_key_len])
elseif type(key.key) == 4 " is a dict elseif type(key.key) == 4 " is a dict
let right_max_key_len = max([len(key.key.name), right_max_key_len]) let right_max_key_len = max([len(key.key.name), right_max_key_len])

View File

@ -1,48 +1,83 @@
let s:self = {} let s:self = {}
function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z) abort function! s:self.check_width(len, sec, winwidth) abort
let l = '%#' . a:hi_a . '#' . a:left_sections[0] return a:len + self.len(a:sec) < a:winwidth
let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep endfunction
let flag = 1
for sec in filter(a:left_sections[1:], '!empty(v:val)') function! s:self.len(sec) abort
if flag == 1 let str = matchstr(a:sec, '%{.*}')
let l .= '%#' . a:hi_b . '#' . sec if !empty(str)
let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep return len(a:sec) - len(str) + len(eval(str[2:-2])) + 4
else else
let l .= '%#' . a:hi_c . '#' . sec return len(a:sec) + 4
let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep endif
endif endfunction
let flag = flag * -1
endfor function! s:self.eval(sec) abort
let l = l[:len(a:lsep) * -1 - 1] return substitute(a:sec, '%{.*}', '', 'g')
if empty(a:right_sections) endfunction
if flag == 1
return l . '%#' . a:hi_c . '#' function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z, winwidth) abort
else let l = '%#' . a:hi_a . '#' . a:left_sections[0]
return l . '%#' . a:hi_b . '#' let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep
endif let flag = 1
let len = 0
for sec in filter(a:left_sections[1:], '!empty(v:val)')
if self.check_width(len, sec, a:winwidth)
let len += self.len(sec)
if flag == 1
let l .= '%#' . a:hi_b . '#' . sec
let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep
else
let l .= '%#' . a:hi_c . '#' . sec
let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep
endif
let flag = flag * -1
endif endif
endfor
let l = l[:len(a:lsep) * -1 - 1]
if empty(a:right_sections)
if flag == 1 if flag == 1
let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' return l . '%#' . a:hi_c . '#'
else else
let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' return l . '%#' . a:hi_b . '#'
endif endif
let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep endif
let flag = 1 if self.check_width(len, a:fname, a:winwidth)
for sec in filter(a:right_sections, '!empty(v:val)') let len += self.len(a:fname)
if flag == 1 if flag == 1
let l .= '%#' . a:hi_b . '#' . sec let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep else
else let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
let l .= '%#' . a:hi_c . '#' . sec endif
let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep else
endif if flag == 1
let flag = flag * -1 let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . '%='
endfor else
return l[:-4] let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . '%='
endif
endif
let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep
let flag = 1
for sec in filter(a:right_sections, '!empty(v:val)')
if self.check_width(len, sec, a:winwidth)
let len += self.len(sec)
if flag == 1
let l .= '%#' . a:hi_b . '#' . sec
let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep
else
let l .= '%#' . a:hi_c . '#' . sec
let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep
endif
let flag = flag * -1
endif
endfor
return l[:-4]
endfunction endfunction
function! SpaceVim#api#vim#statusline#get() abort function! SpaceVim#api#vim#statusline#get() abort
return deepcopy(s:self) return deepcopy(s:self)
endfunction endfunction
" vim:set et sw=2 cc=80 nowrap:

View File

@ -45,7 +45,6 @@ function! SpaceVim#issue#new()
\ 'body' : join(getline(1, '$'), "\n"), \ 'body' : join(getline(1, '$'), "\n"),
\ } \ }
let response = github#api#issues#Create('SpaceVim', 'SpaceVim', username, password, issue) let response = github#api#issues#Create('SpaceVim', 'SpaceVim', username, password, issue)
let g:wsd = response
if has_key(response, 'html_url') if has_key(response, 'html_url')
echo 'Issue created done: ' . response.html_url echo 'Issue created done: ' . response.html_url
else else

View File

@ -110,13 +110,23 @@ function! SpaceVim#layers#autocomplete#config() abort
if s:tab_key_behavior ==# 'smart' if s:tab_key_behavior ==# 'smart'
if has('patch-7.4.774') if has('patch-7.4.774')
imap <silent><expr><TAB> SpaceVim#mapping#tab() imap <silent><expr><TAB> SpaceVim#mapping#tab()
smap <expr><TAB> if g:spacevim_snippet_engine ==# 'neosnippet'
\ neosnippet#expandable_or_jumpable() ? smap <expr><TAB>
\ "\<Plug>(neosnippet_expand_or_jump)" : \ neosnippet#expandable_or_jumpable() ?
\ (complete_parameter#jumpable(1) ? \ "\<Plug>(neosnippet_expand_or_jump)" :
\ "\<plug>(complete_parameter#goto_next_parameter)" : \ (complete_parameter#jumpable(1) ?
\ "\<TAB>") \ "\<plug>(complete_parameter#goto_next_parameter)" :
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab() \ "\<TAB>")
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
elseif g:spacevim_snippet_engine ==# 'ultisnips'
imap <silent><expr><TAB> SpaceVim#mapping#tab()
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
snoremap <silent> <TAB>
\ <ESC>:call UltiSnips#JumpForwards()<CR>
snoremap <silent> <S-TAB>
\ <ESC>:call UltiSnips#JumpBackwards()<CR>
else
endif
else else
call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774') call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774')
endif endif

View File

@ -4,7 +4,14 @@ function! SpaceVim#layers#chat#plugins() abort
\ ] \ ]
endfunction endfunction
let s:BASE64 = SpaceVim#api#import('data#base64')
function! SpaceVim#layers#chat#config() function! SpaceVim#layers#chat#config()
let g:chatting_server_ip = s:BASE64.decode('NDUuNzYuMTAwLjQ5')
let g:chatting_server_port = 8989
if !exists('g:chatting_server_lib')
let g:chatting_server_lib = '/home/wsdjeg/SpaceVim/Chatting-server/target/Chatting-1.0-SNAPSHOT.jar'
endif
call SpaceVim#mapping#space#def('nnoremap', ['a', 'q'], 'call chat#qq#start()', 'Start QQ server', 1) call SpaceVim#mapping#space#def('nnoremap', ['a', 'q'], 'call chat#qq#start()', 'Start QQ server', 1)
call SpaceVim#mapping#space#def('nnoremap', ['a', 'o'], 'call chat#chatting#OpenMsgWin()', 'open spacevim community', 1)
endfunction endfunction

View File

@ -40,7 +40,9 @@ function! SpaceVim#layers#checkers#config() abort
augroup SpaceVim_layer_checker augroup SpaceVim_layer_checker
autocmd! autocmd!
if g:spacevim_enable_ale if g:spacevim_enable_neomake
autocmd User NeomakeFinished nested let &l:statusline = SpaceVim#layers#core#statusline#get(1)
elseif g:spacevim_enable_ale
autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1) autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endif endif
" when move cursor, the error message will be shown below current line " when move cursor, the error message will be shown below current line

View File

@ -131,7 +131,7 @@ function! s:git_branch() abort
call fugitive#detect(getcwd()) call fugitive#detect(getcwd())
let l:head = fugitive#head() let l:head = fugitive#head()
endif endif
return empty(l:head) ? '' : ' '.l:head . ' ' return empty(l:head) ? '' : ' '.l:head . ' '
endif endif
return '' return ''
endfunction endfunction
@ -184,14 +184,72 @@ function! s:battery_status() abort
endif endif
endfunction endfunction
if g:spacevim_enable_neomake
function! s:syntax_checking()
if !exists('g:loaded_neomake')
return ''
endif
let counts = neomake#statusline#LoclistCounts()
let warnings = get(counts, 'W', 0)
let errors = get(counts, 'E', 0)
let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : ''
let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : ''
return l
endfunction
elseif g:spacevim_enable_ale
function! s:syntax_checking()
if !exists('g:ale_enabled')
return ''
endif
let counts = ale#statusline#Count(bufnr(''))
let warnings = counts.warning + counts.style_warning
let errors = counts.error + counts.style_error
let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : ''
let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : ''
return l
endfunction
else
function! s:syntax_checking()
if !exists(':SyntasticCheck')
return ''
endif
let l = SyntasticStatuslineFlag()
if strlen(l) > 0
return l
else
return ''
endif
endfunction
endif
function! s:hunks() abort
let hunks = [0,0,0]
try
let hunks = GitGutterGetHunkSummary()
catch
endtry
let rst = ''
if hunks[0] > 0
let rst .= hunks[0] . '+ '
endif
if hunks[1] > 0
let rst .= hunks[1] . '~ '
endif
if hunks[2] > 0
let rst .= hunks[2] . '- '
endif
return empty(rst) ? '' : ' ' . rst
endfunction
let s:registed_sections = { let s:registed_sections = {
\ 'winnr' : function('s:winnr'), \ 'winnr' : function('s:winnr'),
\ 'syntax checking' : function('s:syntax_checking'),
\ 'filename' : function('s:filename'), \ 'filename' : function('s:filename'),
\ 'fileformat' : function('s:fileformat'), \ 'fileformat' : function('s:fileformat'),
\ 'major mode' : function('s:major_mode'), \ 'major mode' : function('s:major_mode'),
\ 'minor mode lighters' : function('s:modes'), \ 'minor mode lighters' : function('s:modes'),
\ 'version control info' : function('s:git_branch'), \ 'version control info' : function('s:git_branch'),
\ 'hunks' : function('s:hunks'),
\ 'cursorpos' : function('s:cursorpos'), \ 'cursorpos' : function('s:cursorpos'),
\ 'percentage' : function('s:percentage'), \ 'percentage' : function('s:percentage'),
\ 'time' : function('s:time'), \ 'time' : function('s:time'),
@ -236,43 +294,6 @@ function! s:search_status() abort
return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' ' return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' '
endfunction endfunction
if g:spacevim_enable_neomake
function! s:syntax_checking()
if !exists('g:loaded_neomake')
return ''
endif
let counts = neomake#statusline#LoclistCounts()
let warnings = get(counts, 'W', 0)
let errors = get(counts, 'E', 0)
let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : ''
let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : ''
return l
endfunction
elseif g:spacevim_enable_ale
function! s:syntax_checking()
if !exists('g:ale_enabled')
return ''
endif
let counts = ale#statusline#Count(bufnr(''))
let warnings = counts.warning + counts.style_warning
let errors = counts.error + counts.style_error
let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : ''
let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : ''
return l
endfunction
else
function! s:syntax_checking()
if !exists(':SyntasticCheck')
return ''
endif
let l = SyntasticStatuslineFlag()
if strlen(l) > 0
return l
else
return ''
endif
endfunction
endif
function! s:filesize() abort function! s:filesize() abort
@ -292,6 +313,9 @@ function! s:filesize() abort
endfunction endfunction
function! SpaceVim#layers#core#statusline#get(...) abort function! SpaceVim#layers#core#statusline#get(...) abort
for nr in range(1, winnr('$'))
call setwinvar(nr, 'winwidth', winwidth(nr))
endfor
if &filetype ==# 'vimfiler' if &filetype ==# 'vimfiler'
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# vimfiler %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep \ . '%#SpaceVim_statusline_b# vimfiler %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
@ -354,19 +378,25 @@ function! s:active() abort
endfor endfor
let fname = s:buffer_name() let fname = s:buffer_name()
return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, fname, return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, fname,
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr()))
endfunction endfunction
function! s:inactive() abort function! s:inactive() abort
return '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#'
\ . '%#SpaceVim_statusline_b#' . s:filename() . s:ilsep let secs = [s:filename(), &filetype, s:modes(), s:git_branch()]
\ . ' ' . &filetype . ' ' . s:ilsep let base = 10
\ . s:modes() . s:ilsep for sec in secs
\ . s:git_branch() . s:ilsep let len = s:STATUSLINE.len(sec)
\ . ' %=' let base += len
\ . s:irsep . '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}' let l .= '%{ get(w:, "winwidth", 150) < ' . base . ' ? "" : (" ' . s:STATUSLINE.eval(sec) . ' ' . s:ilsep . '")}'
\ . s:irsep . ' %P ' endfor
if get(w:, 'winwidth', 150) > base + 10
let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep)
endif
return l
endfunction endfunction
function! s:gitgutter() abort function! s:gitgutter() abort
if exists('b:gitgutter_summary') if exists('b:gitgutter_summary')
let l:summary = get(b:, 'gitgutter_summary') let l:summary = get(b:, 'gitgutter_summary')
@ -473,10 +503,12 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the cursor position', 1) \ 'toggle the cursor position', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif', call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif',
\ 'toggle the statuline itself', 1) \ 'toggle the statuline itself', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
\ 'toggle the hunks summary', 1)
function! TagbarStatusline(...) abort function! TagbarStatusline(...) abort
let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3 let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3
return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '', return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', g:spacevim_sidebar_width)
endfunction endfunction
let g:tagbar_status_func = 'TagbarStatusline' let g:tagbar_status_func = 'TagbarStatusline'
let g:unite_force_overwrite_statusline = 0 let g:unite_force_overwrite_statusline = 0
@ -508,7 +540,7 @@ endfunction
function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort
return s:STATUSLINE.build([' Ctrlp ', ' ' . a:prev . ' ', ' ' . a:item . ' ', ' ' . a:next . ' '], return s:STATUSLINE.build([' Ctrlp ', ' ' . a:prev . ' ', ' ' . a:item . ' ', ' ' . a:next . ' '],
\ [' ' . a:focus . ' ', ' ' . a:byfname . ' ', ' ' . getcwd() . ' '], s:lsep, s:rsep, '', \ [' ' . a:focus . ' ', ' ' . a:byfname . ' ', ' ' . getcwd() . ' '], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr()))
endfunction endfunction
" @vimlint(EVL103, 0, a:regex) " @vimlint(EVL103, 0, a:regex)
" @vimlint(EVL103, 0, a:marked) " @vimlint(EVL103, 0, a:marked)
@ -518,7 +550,7 @@ endfunction
function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort
return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '], return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '],
\ [' ' . getcwd() . ' '], s:lsep, s:rsep, '', \ [' ' . getcwd() . ' '], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr()))
endfunction endfunction
function! SpaceVim#layers#core#statusline#jump(i) abort function! SpaceVim#layers#core#statusline#jump(i) abort
@ -590,14 +622,14 @@ endfunction
function! SpaceVim#layers#core#statusline#register_sections(name, func) function! SpaceVim#layers#core#statusline#register_sections(name, func)
if has_key(s:registed_sections, a:name) if has_key(s:registed_sections, a:name)
call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!') call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!')
call extend(s:registed_sections, {a:name : a:func}) call extend(s:registed_sections, {a:name : a:func})
else else
call extend(s:registed_sections, {a:name : a:func}) call extend(s:registed_sections, {a:name : a:func})
endif endif
endfunction endfunction
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80 nowrap:

View File

@ -22,188 +22,240 @@ let s:buffers = s:BUFFER.listed_buffers()
" init " init
let s:separators = { let s:separators = {
\ 'arrow' : ["\ue0b0", "\ue0b2"], \ 'arrow' : ["\ue0b0", "\ue0b2"],
\ 'curve' : ["\ue0b4", "\ue0b6"], \ 'curve' : ["\ue0b4", "\ue0b6"],
\ 'slant' : ["\ue0b8", "\ue0ba"], \ 'slant' : ["\ue0b8", "\ue0ba"],
\ 'brace' : ["\ue0d2", "\ue0d4"], \ 'brace' : ["\ue0d2", "\ue0d4"],
\ 'fire' : ["\ue0c0", "\ue0c2"], \ 'fire' : ["\ue0c0", "\ue0c2"],
\ 'nil' : ['', ''], \ 'nil' : ['', ''],
\ } \ }
let s:i_separators = { let s:i_separators = {
\ 'arrow' : ["\ue0b1", "\ue0b3"], \ 'arrow' : ["\ue0b1", "\ue0b3"],
\ 'bar' : ["|", "|"], \ 'bar' : ["|", "|"],
\ 'nil' : ['', ''], \ 'nil' : ['', ''],
\ } \ }
function! s:tabname(id) abort function! s:tabname(id) abort
if g:spacevim_buffer_index_type == 3 if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(a:id) let id = s:messletters.index_num(a:id)
elseif g:spacevim_buffer_index_type == 4 elseif g:spacevim_buffer_index_type == 4
let id = a:id let id = a:id
else else
let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' ' let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
endif endif
let fn = fnamemodify(bufname(a:id), ':t') let fn = fnamemodify(bufname(a:id), ':t')
if g:spacevim_enable_tabline_filetype_icon if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(fn) let icon = s:file.fticon(fn)
if !empty(icon) if !empty(icon)
let fn = icon . ' ' . fn let fn = icon . ' ' . fn
endif
endif
if empty(fn)
return 'No Name'
else
return id . fn
endif endif
endif
if empty(fn)
return 'No Name'
else
return id . fn
endif
endfunction endfunction
function! s:need_show_bfname(stack, nr) abort function! s:need_show_bfname(stack, nr) abort
let dupbufs = filter(a:stack, "fnamemodify(bufname(v:val), ':t') ==# fnamemodify(bufname(a:nr), ':t')") let dupbufs = filter(a:stack, "fnamemodify(bufname(v:val), ':t') ==# fnamemodify(bufname(a:nr), ':t')")
if len(dupbufs) >= 2 if len(dupbufs) >= 2
for i in dupbufs for i in dupbufs
call setbufvar(i, '_spacevim_statusline_showbfname', 1) call setbufvar(i, '_spacevim_statusline_showbfname', 1)
endfor endfor
endif endif
endfunction
function! s:is_modified(nr) abort
return getbufvar(a:nr, '&modified', 0)
endfunction endfunction
function! SpaceVim#layers#core#tabline#get() abort function! SpaceVim#layers#core#tabline#get() abort
let nr = tabpagenr('$') let nr = tabpagenr('$')
let t = '' let t = ''
" the stack should be the bufnr stack of tabline " the stack should be the bufnr stack of tabline
let stack = [] let stack = []
if nr > 1 if nr > 1
let ct = tabpagenr() let ct = tabpagenr()
if ct == 1 if ct == 1
let t = '%#SpaceVim_tabline_a# ' let t = '%#SpaceVim_tabline_a# '
else
let t = '%#SpaceVim_tabline_b# '
endif
for i in range(1, nr)
if i == ct
let t .= '%#SpaceVim_tabline_a#'
endif
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
if empty(name)
let name = 'No Name'
endif
call add(stack, buflist[winnr - 1])
call s:need_show_bfname(stack, buflist[winnr - 1])
if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(i)
elseif g:spacevim_buffer_index_type == 4
let id = i
else
let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type)
endif
if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(name)
if !empty(icon)
let name = icon . ' ' . name
endif
endif
let t .= id . ' ' . name
if i == ct - 1
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
elseif i == ct
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
else
let t .= ' ' . s:ilsep . ' '
endif
endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Tabs '
else else
let s:buffers = s:BUFFER.listed_buffers() let t = '%#SpaceVim_tabline_b# '
let g:_spacevim_list_buffers = s:buffers
if len(s:buffers) == 0
return ''
endif
let ct = bufnr('%')
let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1
if ct == get(s:buffers, 0, -1)
let t = '%#SpaceVim_tabline_a# '
else
let t = '%#SpaceVim_tabline_b# '
endif
for i in s:buffers
if i == ct
let t .= '%#SpaceVim_tabline_a#'
endif
let name = fnamemodify(bufname(i), ':t')
if empty(name)
let name = 'No Name'
endif
call add(stack, i)
call s:need_show_bfname(stack, i)
if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(index(s:buffers, i) + 1)
elseif g:spacevim_buffer_index_type == 4
let id = index(s:buffers, i) + 1
else
let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type)
endif
if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(name)
if !empty(icon)
let name = icon . ' ' . name
endif
endif
let t .= id . ' ' . name
if i == ct
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
elseif i == pt
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
else
let t .= ' ' . s:ilsep . ' '
endif
endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Buffers '
endif endif
return t for i in range(1, nr)
if i == ct
let t .= '%#SpaceVim_tabline_a#'
endif
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
if empty(name)
let name = 'No Name'
endif
call add(stack, buflist[winnr - 1])
call s:need_show_bfname(stack, buflist[winnr - 1])
if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(i)
elseif g:spacevim_buffer_index_type == 4
let id = i
else
let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type)
endif
if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(name)
if !empty(icon)
let name = icon . ' ' . name
endif
endif
let t .= id . ' ' . name
if i == ct - 1
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
elseif i == ct
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
else
let t .= ' ' . s:ilsep . ' '
endif
endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Tabs '
else
let s:buffers = s:BUFFER.listed_buffers()
let g:_spacevim_list_buffers = s:buffers
if len(s:buffers) == 0
return ''
endif
let ct = bufnr('%')
let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1
if ct == get(s:buffers, 0, -1)
if getbufvar(ct, '&modified', 0)
let t = '%#SpaceVim_tabline_m# '
else
let t = '%#SpaceVim_tabline_a# '
endif
else
let t = '%#SpaceVim_tabline_b# '
endif
let index = 1
for i in s:buffers
if getbufvar(i, '&modified', 0) && i != ct
let t .= '%#SpaceVim_tabline_m_i#'
elseif i == ct
if s:is_modified(i)
let t .= '%#SpaceVim_tabline_m#'
else
let t .= '%#SpaceVim_tabline_a#'
endif
else
let t .= '%#SpaceVim_tabline_b#'
endif
let name = fnamemodify(bufname(i), ':t')
if empty(name)
let name = 'No Name'
endif
call add(stack, i)
call s:need_show_bfname(stack, i)
" here is the begin of a tab name
if has('tablineat')
let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@'
endif
if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(index(s:buffers, i) + 1)
elseif g:spacevim_buffer_index_type == 4
let id = index(s:buffers, i) + 1
else
let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type)
endif
if g:spacevim_enable_tabline_filetype_icon
let icon = s:file.fticon(name)
if !empty(icon)
let name = icon . ' ' . name
endif
endif
let t .= id . ' ' . name
" here is the end of a tabname
if has('tablineat')
let t .= '%X'
endif
if i == ct
if s:is_modified(i)
let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' '
else
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
endif
elseif i == pt
if getbufvar(ct, '&modified', 0)
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_m#' . s:lsep . ' '
else
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
endif
else
let t .= ' %#SpaceVim_tabline_b#' . s:ilsep . ' '
endif
let index += 1
endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Buffers '
endif
return t
endfunction endfunction
function! SpaceVim#layers#core#tabline#config() abort function! SpaceVim#layers#core#tabline#config() abort
let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) 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:separators['arrow']) let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:separators['arrow'])
set tabline=%!SpaceVim#layers#core#tabline#get() set tabline=%!SpaceVim#layers#core#tabline#get()
augroup SpaceVim_tabline augroup SpaceVim_tabline
autocmd! autocmd!
autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors() autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors()
augroup END augroup END
for i in range(1, 9) for i in range(1, 9)
exe "call SpaceVim#mapping#def('nmap <silent>', '<leader>" . i exe "call SpaceVim#mapping#def('nmap <silent>', '<leader>" . i
\ . "', ':call SpaceVim#layers#core#tabline#jump(" \ . "', ':call SpaceVim#layers#core#tabline#jump("
\ . i . ")<cr>', 'Switch to airline tab " . i \ . i . ")<cr>', 'Switch to airline tab " . i
\ . "', '', 'tabline index " . i . "')" \ . "', '', 'tabline index " . i . "')"
endfor endfor
call SpaceVim#mapping#def('nmap', '<leader>-', ':bprevious<cr>', 'Switch to previous airline tag', '', 'window previous') call SpaceVim#mapping#def('nmap', '<leader>-', ':bprevious<cr>', 'Switch to previous airline tag', '', 'window previous')
call SpaceVim#mapping#def('nmap', '<leader>+', ':bnext<cr>', 'Switch to next airline tag', '', 'window next') call SpaceVim#mapping#def('nmap', '<leader>+', ':bnext<cr>', 'Switch to next airline tag', '', 'window next')
"call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1) "call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1)
"call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1) "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1)
endfunction endfunction
function! SpaceVim#layers#core#tabline#jump(id) abort function! SpaceVim#layers#core#tabline#jump(id, ...) abort
if get(a:000, 2, '') == 'm'
if len(s:buffers) >= a:id if len(s:buffers) >= a:id
let bid = s:buffers[a:id - 1] let bid = s:buffers[a:id - 1]
exe 'silent b' . bid exe 'silent b' . bid
bd
endif endif
elseif get(a:000, 2, '') == 'l'
if len(s:buffers) >= a:id
let bid = s:buffers[a:id - 1]
exe 'silent b' . bid
endif
else
if len(s:buffers) >= a:id
let bid = s:buffers[a:id - 1]
exe 'silent b' . bid
endif
endif
endfunction endfunction
function! SpaceVim#layers#core#tabline#def_colors() abort function! SpaceVim#layers#core#tabline#def_colors() abort
if !empty(g:spacevim_custom_color_palette) if !empty(g:spacevim_custom_color_palette)
let t = g:spacevim_custom_color_palette let t = g:spacevim_custom_color_palette
else else
let name = get(g:, 'colors_name', 'gruvbox') let name = get(g:, 'colors_name', 'gruvbox')
try try
let t = SpaceVim#mapping#guide#theme#{name}#palette() let t = SpaceVim#mapping#guide#theme#{name}#palette()
catch /^Vim\%((\a\+)\)\=:E117/ catch /^Vim\%((\a\+)\)\=:E117/
let t = SpaceVim#mapping#guide#theme#gruvbox#palette() let t = SpaceVim#mapping#guide#theme#gruvbox#palette()
endtry endtry
endif endif
exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b') " SpaceVim_tabline_c is for modified buffers
exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
exe 'hi! SpaceVim_tabline_m_i ctermbg=' . t[1][2] . ' ctermfg=' . t[4][3] . ' guibg=' . t[1][1] . ' guifg=' . t[4][1]
call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b')
call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_b')
call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_a')
endfunction endfunction

View File

@ -5,439 +5,497 @@
let s:filename = expand('<sfile>:~') let s:filename = expand('<sfile>:~')
function! SpaceVim#layers#default#plugins() abort function! SpaceVim#layers#default#plugins() abort
let plugins = [] let plugins = []
return plugins return plugins
endfunction endfunction
let s:lnum = expand('<slnum>') + 3 let s:lnum = expand('<slnum>') + 3
function! SpaceVim#layers#default#config() abort function! SpaceVim#layers#default#config() abort
" Unimpaired bindings " Unimpaired bindings
" Quickly add empty lines " Quickly add empty lines
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>
"]e or [e move current line ,count can be useed "]e or [e move current line ,count can be useed
nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr> nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr>
nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr> nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr>
" [b or ]n go to previous or next buffer " [b or ]n go to previous or next buffer
nnoremap <silent> [b :<c-u>bN<cr> nnoremap <silent> [b :<c-u>bN<cr>
nnoremap <silent> ]b :<c-u>bn<cr> nnoremap <silent> ]b :<c-u>bn<cr>
" [f or ]f go to next or previous file in dir " [f or ]f go to next or previous file in dir
nnoremap <silent> ]f :<c-u>call <SID>next_file()<cr> nnoremap <silent> ]f :<c-u>call <SID>next_file()<cr>
nnoremap <silent> [f :<c-u>call <SID>previous_file()<cr> nnoremap <silent> [f :<c-u>call <SID>previous_file()<cr>
" [l or ]l go to next and previous error " [l or ]l go to next and previous error
nnoremap <silent> [l :lprevious<cr> nnoremap <silent> [l :lprevious<cr>
nnoremap <silent> ]l :lnext<cr> nnoremap <silent> ]l :lnext<cr>
" [c or ]c go to next or previous vcs hunk " [c or ]c go to next or previous vcs hunk
" [w or ]w go to next or previous window " [w or ]w go to next or previous window
nnoremap <silent> [w :call <SID>previous_window()<cr> nnoremap <silent> [w :call <SID>previous_window()<cr>
nnoremap <silent> ]w :call <SID>next_window()<cr> nnoremap <silent> ]w :call <SID>next_window()<cr>
" [t or ]t for next and previous tab " [t or ]t for next and previous tab
nnoremap <silent> [t :tabprevious<cr> nnoremap <silent> [t :tabprevious<cr>
nnoremap <silent> ]t :tabnext<cr> nnoremap <silent> ]t :tabnext<cr>
" [p or ]p for p and P " [p or ]p for p and P
nnoremap <silent> [p P nnoremap <silent> [p P
nnoremap <silent> ]p p nnoremap <silent> ]p p
" Select last paste " Select last paste
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]' nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
let lnum = expand('<slnum>') + s:lnum - 1 let lnum = expand('<slnum>') + s:lnum - 1
if has('python3') if has('python3')
let cmd = 'DeniteBufferDir file_rec' let cmd = 'DeniteBufferDir file_rec'
elseif has('python') elseif has('python')
let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')" let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')"
else else
let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')" let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')"
endif endif
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'],
\ cmd, \ cmd,
\ ['Find files in the directory of the current buffer', \ ['Find files in the directory of the current buffer',
\ [ \ [
\ '[SPC f f] is to find files in the directory of the current buffer', \ '[SPC f f] is to find files in the directory of the current buffer',
\ 'vim with +python3 support will use denite', \ 'vim with +python3 support will use denite',
\ 'vim with +python support will use leaderf', \ 'vim with +python support will use leaderf',
\ 'otherwise will use ctrlp', \ 'otherwise will use ctrlp',
\ '', \ '',
\ 'Definition: ' . s:filename . ':' . lnum, \ 'Definition: ' . s:filename . ':' . lnum,
\ ] \ ]
\ ] \ ]
\ , 1) \ , 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
" help mappings " help mappings
call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1)
if has('python3') if has('python3')
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1)
else else
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
endif endif
call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1) call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)
call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '<C-o>', 'jump backward', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '<C-o>', 'jump backward', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '<C-i>', 'jump forward', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '<C-i>', 'jump forward', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1) call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1) call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1)
call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '<Plug>(easymotion-prefix)s', 'jump to a character', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '<Plug>(easymotion-prefix)s', 'jump to a character', 0)
call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '<Plug>(easymotion-s2)', 'jump to a suite of two characters', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '<Plug>(easymotion-s2)', 'jump to a suite of two characters', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0)
call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0)
call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0)
call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '<Plug>(easymotion-bd-w)', 'jump to a word', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '<Plug>(easymotion-bd-w)', 'jump to a word', 0)
call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '<Plug>(easymotion-bd-jk)', 'jump to a line', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\<cr>\<esc>", 'sp-newline', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\<cr>\<esc>", 'sp-newline', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\<cr>\<esc>k$", 'open-line', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\<cr>\<esc>k$", 'open-line', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call('
\ . string(s:_function('s:split_string')) . ', [0])', \ . string(s:_function('s:split_string')) . ', [0])',
\ 'split sexp', 1) \ 'split sexp', 1)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call('
\ . string(s:_function('s:split_string')) . ', [1])', \ . string(s:_function('s:split_string')) . ', [1])',
\ 'split-and-add-newline', 1) \ 'split-and-add-newline', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call('
\ . string(s:_function('s:next_window')) . ', [])', \ . string(s:_function('s:next_window')) . ', [])',
\ 'rotate windows forward', 1) \ 'rotate windows forward', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call('
\ . string(s:_function('s:previous_window')) . ', [])', \ . string(s:_function('s:previous_window')) . ', [])',
\ 'rotate windows backward', 1) \ 'rotate windows backward', 1)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call('
\ . string(s:_function('s:jump_to_url')) . ', [])', \ . string(s:_function('s:jump_to_url')) . ', [])',
\ 'jump to url', 1) \ 'jump to url', 1)
call SpaceVim#mapping#space#def('nnoremap', ['<Tab>'], 'try | b# | catch | endtry', 'last buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['<Tab>'], 'try | b# | catch | endtry', 'last buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call('
\ . string(s:_function('s:buffer_transient_state')) . ', [])', \ . string(s:_function('s:buffer_transient_state')) . ', [])',
\ 'buffer transient state', 1) \ 'buffer transient state', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'], call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'],
\ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()', \ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()',
\ 'kill-this-buffer', 1) \ 'kill-this-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', '<C-d>'], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', '<C-d>'], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call('
\ . string(s:_function('s:safe_erase_buffer')) . ', [])', \ . string(s:_function('s:safe_erase_buffer')) . ', [])',
\ 'safe-erase-buffer', 1) \ 'safe-erase-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call('
\ . string(s:_function('s:open_message_buffer')) . ', [])', \ . string(s:_function('s:open_message_buffer')) . ', [])',
\ 'open-message-buffer', 1) \ 'open-message-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call('
\ . string(s:_function('s:safe_revert_buffer')) . ', [])', \ . string(s:_function('s:safe_revert_buffer')) . ', [])',
\ 'safe-revert-buffer', 1) \ 'safe-revert-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1)
let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'} let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'}
call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1)
" file mappings " file mappings
call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'Unite vim_bookmarks', 'unite-filtered-bookmarks', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'Unite vim_bookmarks', 'unite-filtered-bookmarks', 1)
let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'} let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'}
call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call('
\ . string(s:_function('s:delete_current_buffer_file')) . ', [])', \ . string(s:_function('s:delete_current_buffer_file')) . ', [])',
\ 'delete-current-buffer-file', 1) \ 'delete-current-buffer-file', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1)
if g:spacevim_filemanager ==# 'vimfiler' if g:spacevim_filemanager ==# 'vimfiler'
call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1)
elseif g:spacevim_filemanager ==# 'nerdtree' elseif g:spacevim_filemanager ==# 'nerdtree'
call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1)
endif endif
call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1)
let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'} let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'}
call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1)
let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['n', '-'], 'call call('
\ . string(s:_function('s:number_transient_state')) . ', ["-"])',
\ ['Decrease number under cursor',
\ [
\ '[SPC n -] is to decrease the number under the cursor, and open',
\ 'the number translate state buffer',
\ '',
\ 'Definition: ' . s:filename . ':' . lnum,
\ ]
\ ]
\ , 1)
let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call('
\ . string(s:_function('s:number_transient_state')) . ', ["+"])',
\ ['Increase number under cursor',
\ [
\ '[SPC n +] is to increase the number under the cursor, and open',
\ 'the number translate state buffer',
\ '',
\ 'Definition: ' . s:filename . ':' . lnum,
\ ]
\ ]
\ , 1)
endfunction
function! s:number_transient_state(n) abort
if a:n ==# '+'
exe "normal! \<c-a>"
else
exe "normal! \<c-x>"
endif
let state = SpaceVim#api#import('transient_state')
call state.set_title('Number Transient State')
call state.defind_keys(
\ {
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : ['+','='],
\ 'desc' : 'increase number',
\ 'func' : '',
\ 'cmd' : "normal! \<c-a>",
\ 'exit' : 0,
\ },
\ ],
\ 'right' : [
\ {
\ 'key' : '-',
\ 'desc' : 'decrease number',
\ 'func' : '',
\ 'cmd' : "normal! \<c-x>",
\ 'exit' : 0,
\ },
\ ],
\ }
\ )
call state.open()
endfunction endfunction
let s:file = SpaceVim#api#import('file') let s:file = SpaceVim#api#import('file')
let s:MESSAGE = SpaceVim#api#import('vim#message') let s:MESSAGE = SpaceVim#api#import('vim#message')
function! s:next_file() abort function! s:next_file() abort
let dir = expand('%:p:h') let dir = expand('%:p:h')
let f = expand('%:t') let f = expand('%:t')
let file = s:file.ls(dir, 1) let file = s:file.ls(dir, 1)
if index(file, f) == -1 if index(file, f) == -1
call add(file,f) call add(file,f)
endif endif
call sort(file) call sort(file)
if len(file) != 1 if len(file) != 1
if index(file, f) == len(file) - 1 if index(file, f) == len(file) - 1
exe 'e ' . dir . s:file.separator . file[0] exe 'e ' . dir . s:file.separator . file[0]
else else
exe 'e ' . dir . s:file.separator . file[index(file, f) + 1] exe 'e ' . dir . s:file.separator . file[index(file, f) + 1]
endif
endif endif
endif
endfunction endfunction
function! s:previous_file() abort function! s:previous_file() abort
let dir = expand('%:p:h') let dir = expand('%:p:h')
let f = expand('%:t') let f = expand('%:t')
let file = s:file.ls(dir, 1) let file = s:file.ls(dir, 1)
if index(file, f) == -1 if index(file, f) == -1
call add(file,f) call add(file,f)
endif endif
call sort(file) call sort(file)
if len(file) != 1 if len(file) != 1
if index(file, f) == 0 if index(file, f) == 0
exe 'e ' . dir . s:file.separator . file[-1] exe 'e ' . dir . s:file.separator . file[-1]
else else
exe 'e ' . dir . s:file.separator . file[index(file, f) - 1] exe 'e ' . dir . s:file.separator . file[index(file, f) - 1]
endif
endif endif
endif
endfunction endfunction
function! s:next_window() abort function! s:next_window() abort
try try
exe (winnr() + 1 ) . 'wincmd w' exe (winnr() + 1 ) . 'wincmd w'
catch catch
exe 1 . 'wincmd w' exe 1 . 'wincmd w'
endtry endtry
endfunction endfunction
function! s:previous_window() abort function! s:previous_window() abort
try try
if winnr() == 1 if winnr() == 1
exe winnr('$') . 'wincmd w' exe winnr('$') . 'wincmd w'
else else
exe (winnr() - 1 ) . 'wincmd w' exe (winnr() - 1 ) . 'wincmd w'
endif endif
catch catch
exe winnr('$') . 'wincmd w' exe winnr('$') . 'wincmd w'
endtry endtry
endfunction endfunction
function! s:split_string(newline) abort function! s:split_string(newline) abort
let syn_name = synIDattr(synID(line("."), col("."), 1), "name") let syn_name = synIDattr(synID(line("."), col("."), 1), "name")
if syn_name == &filetype . 'String' if syn_name == &filetype . 'String'
let c = col('.') let c = col('.')
let sep = '' let sep = ''
while c > 0 while c > 0
if s:is_string(line('.'), c) if s:is_string(line('.'), c)
let c = c - 1 let c = c - 1
else else
let sep = getline('.')[c] let sep = getline('.')[c]
break break
endif endif
endwhile endwhile
if a:newline if a:newline
let save_register_m = @m let save_register_m = @m
let @m = sep . "\n" . sep let @m = sep . "\n" . sep
normal! "mp normal! "mp
let @m = save_register_m let @m = save_register_m
else else
let save_register_m = @m let save_register_m = @m
let @m = sep . sep let @m = sep . sep
normal! "mp normal! "mp
let @m = save_register_m let @m = save_register_m
endif
endif endif
endif
endfunction endfunction
function! s:is_string(l,c) abort function! s:is_string(l,c) abort
return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String' return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String'
endfunction endfunction
" function() wrapper " function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170') if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort function! s:_function(fstr) abort
return function(a:fstr) return function(a:fstr)
endfunction endfunction
else else
function! s:_SID() abort function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction endfunction
let s:_s = '<SNR>' . s:_SID() . '_' let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g')) return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction endfunction
endif endif
function! s:jump_to_url() abort function! s:jump_to_url() abort
let g:EasyMotion_re_anywhere = 'http[s]*://' let g:EasyMotion_re_anywhere = 'http[s]*://'
call feedkeys("\<Plug>(easymotion-jumptoanywhere)") call feedkeys("\<Plug>(easymotion-jumptoanywhere)")
endfunction endfunction
function! s:safe_erase_buffer() abort function! s:safe_erase_buffer() abort
if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t')) if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t'))
normal! ggdG normal! ggdG
endif endif
redraw! redraw!
endfunction endfunction
function! s:open_message_buffer() abort function! s:open_message_buffer() abort
vertical topleft edit __Message_Buffer__ vertical topleft edit __Message_Buffer__
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber
setf message setf message
normal! ggdG normal! ggdG
silent put =execute(':message') silent put =execute(':message')
normal! G normal! G
setlocal nomodifiable setlocal nomodifiable
nnoremap <silent> <buffer> q :silent bd<CR> nnoremap <silent> <buffer> q :silent bd<CR>
endfunction endfunction
function! s:safe_revert_buffer() abort function! s:safe_revert_buffer() abort
if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p')) if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p'))
edit! edit!
endif endif
redraw! redraw!
endfunction endfunction
function! s:delete_current_buffer_file() abort function! s:delete_current_buffer_file() abort
if s:MESSAGE.confirm('Are you sure you want to delete this file') if s:MESSAGE.confirm('Are you sure you want to delete this file')
let f = fnameescape(expand('%:p')) let f = fnameescape(expand('%:p'))
call SpaceVim#mapping#close_current_buffer() call SpaceVim#mapping#close_current_buffer()
if delete(f) == 0 if delete(f) == 0
echo "File '" . f . "' successfully removed" echo "File '" . f . "' successfully removed"
endif
endif endif
redraw! endif
redraw!
endfunction endfunction
function! s:swap_buffer_with_nth_win(nr) abort function! s:swap_buffer_with_nth_win(nr) abort
if a:nr <= winnr('$') && a:nr != winnr() if a:nr <= winnr('$') && a:nr != winnr()
let cb = bufnr('%') let cb = bufnr('%')
let tb = winbufnr(a:nr) let tb = winbufnr(a:nr)
if cb != tb if cb != tb
exe a:nr . 'wincmd w' exe a:nr . 'wincmd w'
exe 'b' . cb exe 'b' . cb
wincmd p wincmd p
exe 'b' . tb exe 'b' . tb
endif
endif endif
endif
endfunction endfunction
function! s:move_buffer_to_nth_win(nr) abort function! s:move_buffer_to_nth_win(nr) abort
if a:nr <= winnr('$') && a:nr != winnr() if a:nr <= winnr('$') && a:nr != winnr()
let cb = bufnr('%') let cb = bufnr('%')
bp bp
exe a:nr . 'wincmd w' exe a:nr . 'wincmd w'
exe 'b' . cb exe 'b' . cb
wincmd p wincmd p
endif endif
endfunction endfunction
function! s:buffer_transient_state() abort function! s:buffer_transient_state() abort
let state = SpaceVim#api#import('transient_state') let state = SpaceVim#api#import('transient_state')
call state.set_title('Buffer Selection Transient State') call state.set_title('Buffer Selection Transient State')
call state.defind_keys( call state.defind_keys(
\ { \ {
\ 'layout' : 'vertical split', \ 'layout' : 'vertical split',
\ 'left' : [ \ 'left' : [
\ { \ {
\ 'key' : { \ 'key' : {
\ 'name' : 'C-1..C-9', \ 'name' : 'C-1..C-9',
\ 'pos' : [[1,4], [6,9]], \ 'pos' : [[1,4], [6,9]],
\ 'handles' : [ \ 'handles' : [
\ ["\<C-1>" , ''], \ ["\<C-1>" , ''],
\ ["\<C-2>" , ''], \ ["\<C-2>" , ''],
\ ["\<C-3>" , ''], \ ["\<C-3>" , ''],
\ ["\<C-4>" , ''], \ ["\<C-4>" , ''],
\ ["\<C-5>" , ''], \ ["\<C-5>" , ''],
\ ["\<C-6>" , ''], \ ["\<C-6>" , ''],
\ ["\<C-7>" , ''], \ ["\<C-7>" , ''],
\ ["\<C-8>" , ''], \ ["\<C-8>" , ''],
\ ["\<C-9>" , ''], \ ["\<C-9>" , ''],
\ ], \ ],
\ }, \ },
\ 'desc' : 'goto nth window', \ 'desc' : 'goto nth window',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : '', \ 'cmd' : '',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ { \ {
\ 'key' : { \ 'key' : {
\ 'name' : '1..9', \ 'name' : '1..9',
\ 'pos' : [[1,2], [4,5]], \ 'pos' : [[1,2], [4,5]],
\ 'handles' : [ \ 'handles' : [
\ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'], \ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'],
\ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'], \ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'],
\ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'], \ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'],
\ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'], \ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'],
\ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'], \ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'],
\ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'], \ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'],
\ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'], \ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'],
\ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'], \ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'],
\ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'], \ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'],
\ ], \ ],
\ }, \ },
\ 'desc' : 'move buffer to nth window', \ 'desc' : 'move buffer to nth window',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : '', \ 'cmd' : '',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ { \ {
\ 'key' : { \ 'key' : {
\ 'name' : 'M-1..M-9', \ 'name' : 'M-1..M-9',
\ 'pos' : [[1,4], [6,9]], \ 'pos' : [[1,4], [6,9]],
\ 'handles' : [ \ 'handles' : [
\ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'], \ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
\ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'], \ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
\ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'], \ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
\ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'], \ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
\ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'], \ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
\ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'], \ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
\ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'], \ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
\ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'], \ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
\ ["\<M-9>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'], \ ["\<M-9>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'],
\ ], \ ],
\ }, \ },
\ 'desc' : 'swap buffer with nth window', \ 'desc' : 'swap buffer with nth window',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : '', \ 'cmd' : '',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ ], \ ],
\ 'right' : [ \ 'right' : [
\ { \ {
\ 'key' : 'n', \ 'key' : 'n',
\ 'desc' : 'next buffer', \ 'desc' : 'next buffer',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : 'bnext', \ 'cmd' : 'bnext',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ { \ {
\ 'key' : ['N', 'p'], \ 'key' : ['N', 'p'],
\ 'desc' : 'previous buffer', \ 'desc' : 'previous buffer',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : 'bp', \ 'cmd' : 'bp',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ { \ {
\ 'key' : 'd', \ 'key' : 'd',
\ 'desc' : 'kill buffer', \ 'desc' : 'kill buffer',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()', \ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ { \ {
\ 'key' : 'q', \ 'key' : 'q',
\ 'desc' : 'quit', \ 'desc' : 'quit',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : '', \ 'cmd' : '',
\ 'exit' : 1, \ 'exit' : 1,
\ }, \ },
\ ], \ ],
\ } \ }
\ ) \ )
call state.open() call state.open()
endfunction endfunction

View File

@ -4,406 +4,412 @@ let s:NUMBER = SpaceVim#api#import('data#number')
let s:LIST = SpaceVim#api#import('data#list') let s:LIST = SpaceVim#api#import('data#list')
function! SpaceVim#layers#edit#plugins() abort function! SpaceVim#layers#edit#plugins() abort
let plugins = [ let plugins = [
\ ['tpope/vim-surround'], \ ['tpope/vim-surround'],
\ ['tpope/vim-repeat'], \ ['tpope/vim-repeat'],
\ ['junegunn/vim-emoji'], \ ['junegunn/vim-emoji'],
\ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}], \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}],
\ ['terryma/vim-expand-region', { 'loadconf' : 1}], \ ['terryma/vim-expand-region', { 'loadconf' : 1}],
\ ['kana/vim-textobj-user'], \ ['kana/vim-textobj-user'],
\ ['kana/vim-textobj-indent'], \ ['kana/vim-textobj-indent'],
\ ['kana/vim-textobj-line'], \ ['kana/vim-textobj-line'],
\ ['kana/vim-textobj-entire'], \ ['kana/vim-textobj-entire'],
\ ['scrooloose/nerdcommenter', { 'loadconf' : 1}], \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}],
\ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}], \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}],
\ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}], \ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}],
\ ['easymotion/vim-easymotion'], \ ['easymotion/vim-easymotion'],
\ ['haya14busa/vim-easyoperator-line'], \ ['haya14busa/vim-easyoperator-line'],
\ ['editorconfig/editorconfig-vim', { 'merged' : 0}], \ ['editorconfig/editorconfig-vim', { 'merged' : 0}],
\ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}], \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}],
\ ['osyo-manga/vim-jplus', { 'on_map' : '<Plug>(jplus' }], \ ['osyo-manga/vim-jplus', { 'on_map' : '<Plug>(jplus' }],
\ ] \ ]
if executable('fcitx') if executable('fcitx')
call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}]) call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}])
endif endif
return plugins return plugins
endfunction endfunction
function! SpaceVim#layers#edit#config() abort function! SpaceVim#layers#edit#config() abort
let g:multi_cursor_next_key=get(g:, 'multi_cursor_next_key', '<C-n>') let g:multi_cursor_next_key=get(g:, 'multi_cursor_next_key', '<C-n>')
let g:multi_cursor_prev_key=get(g:, 'multi_cursor_prev_key', '<C-m>') let g:multi_cursor_prev_key=get(g:, 'multi_cursor_prev_key', '<C-m>')
let g:multi_cursor_skip_key=get(g:, 'multi_cursor_skip_key', '<C-x>') let g:multi_cursor_skip_key=get(g:, 'multi_cursor_skip_key', '<C-x>')
let g:multi_cursor_quit_key=get(g:, 'multi_cursor_quit_key', '<Esc>') let g:multi_cursor_quit_key=get(g:, 'multi_cursor_quit_key', '<Esc>')
let g:user_emmet_install_global = 0 let g:user_emmet_install_global = 0
let g:user_emmet_leader_key=get(g:, 'user_emmet_leader_key', '<C-e>') let g:user_emmet_leader_key=get(g:, 'user_emmet_leader_key', '<C-e>')
let g:user_emmet_mode='a' let g:user_emmet_mode='a'
let g:user_emmet_settings = { let g:user_emmet_settings = {
\ 'jsp' : { \ 'jsp' : {
\ 'extends' : 'html', \ 'extends' : 'html',
\ }, \ },
\} \}
"noremap <SPACE> <Plug>(wildfire-fuel) "noremap <SPACE> <Plug>(wildfire-fuel)
vnoremap <C-SPACE> <Plug>(wildfire-water) vnoremap <C-SPACE> <Plug>(wildfire-water)
let g:wildfire_objects = ["i'", 'i"', 'i)', 'i]', 'i}', 'ip', 'it'] let g:wildfire_objects = ["i'", 'i"', 'i)', 'i]', 'i}', 'ip', 'it']
" osyo-manga/vim-jplus {{{ " osyo-manga/vim-jplus {{{
nmap <silent> J <Plug>(jplus) nmap <silent> J <Plug>(jplus)
vmap <silent> J <Plug>(jplus) vmap <silent> J <Plug>(jplus)
" }}} " }}}
let g:_spacevim_mappings_space.x = {'name' : '+Text'} let g:_spacevim_mappings_space.x = {'name' : '+Text'}
let g:_spacevim_mappings_space.x.a = {'name' : '+align'} let g:_spacevim_mappings_space.x.a = {'name' : '+align'}
let g:_spacevim_mappings_space.x.d = {'name' : '+delete'} let g:_spacevim_mappings_space.x.d = {'name' : '+delete'}
let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'} let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'}
nnoremap <silent> <Plug>CountSelectionRegion :call <SID>count_selection_region()<Cr> nnoremap <silent> <Plug>CountSelectionRegion :call <SID>count_selection_region()<Cr>
xnoremap <silent> <Plug>CountSelectionRegion :<C-u>call <SID>count_selection_region()<Cr> xnoremap <silent> <Plug>CountSelectionRegion :<C-u>call <SID>count_selection_region()<Cr>
call SpaceVim#mapping#space#def('nmap', ['x', 'c'], '<Plug>CountSelectionRegion', 'count in the selection region', 0, 1) call SpaceVim#mapping#space#def('nmap', ['x', 'c'], '<Plug>CountSelectionRegion', 'count in the selection region', 0, 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '['], 'Tabularize /[', 'align region at [', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '['], 'Tabularize /[', 'align region at [', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ']'], 'Tabularize /]', 'align region at ]', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ']'], 'Tabularize /]', 'align region at ]', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '{'], 'Tabularize /{', 'align region at {', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '{'], 'Tabularize /{', 'align region at {', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '}'], 'Tabularize /}', 'align region at }', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '}'], 'Tabularize /}', 'align region at }', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ','], 'Tabularize /,', 'align region at ,', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ','], 'Tabularize /,', 'align region at ,', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '.'], 'Tabularize /.', 'align region at .', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '.'], 'Tabularize /.', 'align region at .', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ':'], 'Tabularize /:', 'align region at :', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ':'], 'Tabularize /:', 'align region at :', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ';'], 'Tabularize /;', 'align region at ;', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ';'], 'Tabularize /;', 'align region at ;', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '='], 'Tabularize /=', 'align region at =', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '='], 'Tabularize /=', 'align region at =', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '¦'], 'Tabularize /¦', 'align region at ¦', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '¦'], 'Tabularize /¦', 'align region at ¦', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', 'w'], 'StripWhitespace', 'delete trailing whitespaces', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', 'w'], 'StripWhitespace', 'delete trailing whitespaces', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', '[SPC]'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', '[SPC]'], 'silent call call('
\ . string(s:_function('s:delete_extra_space')) . ', [])', \ . string(s:_function('s:delete_extra_space')) . ', [])',
\ 'delete extra space arround cursor', 1) \ 'delete extra space arround cursor', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'c'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'c'], 'silent call call('
\ . string(s:_function('s:lowerCamelCase')) . ', [])', \ . string(s:_function('s:lowerCamelCase')) . ', [])',
\ 'change symbol style to lowerCamelCase', 1) \ 'change symbol style to lowerCamelCase', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'C'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'C'], 'silent call call('
\ . string(s:_function('s:UpperCamelCase')) . ', [])', \ . string(s:_function('s:UpperCamelCase')) . ', [])',
\ 'change symbol style to UpperCamelCase', 1) \ 'change symbol style to UpperCamelCase', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '_'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '_'], 'silent call call('
\ . string(s:_function('s:under_score')) . ', [])', \ . string(s:_function('s:under_score')) . ', [])',
\ 'change symbol style to under_score', 1) \ 'change symbol style to under_score', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'u'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'u'], 'silent call call('
\ . string(s:_function('s:under_score')) . ', [])', \ . string(s:_function('s:under_score')) . ', [])',
\ 'change symbol style to under_score', 1) \ 'change symbol style to under_score', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'U'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'U'], 'silent call call('
\ . string(s:_function('s:up_case')) . ', [])', \ . string(s:_function('s:up_case')) . ', [])',
\ 'change symbol style to UP_CACE', 1) \ 'change symbol style to UP_CACE', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'k'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'k'], 'silent call call('
\ . string(s:_function('s:kebab_case')) . ', [])', \ . string(s:_function('s:kebab_case')) . ', [])',
\ 'change symbol style to kebab-case', 1) \ 'change symbol style to kebab-case', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '-'], 'silent call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '-'], 'silent call call('
\ . string(s:_function('s:kebab_case')) . ', [])', \ . string(s:_function('s:kebab_case')) . ', [])',
\ 'change symbol style to kebab-case', 1) \ 'change symbol style to kebab-case', 1)
let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} let g:_spacevim_mappings_space.i = {'name' : '+Insertion'}
let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'}
let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'} let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'}
let g:_spacevim_mappings_space.i.U = {'name' : '+UUID'} let g:_spacevim_mappings_space.i.U = {'name' : '+UUID'}
call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 1], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 1], 'call call('
\ . string(s:_function('s:insert_simple_password')) . ', [])', \ . string(s:_function('s:insert_simple_password')) . ', [])',
\ 'insert simple password', 1) \ 'insert simple password', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 2], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 2], 'call call('
\ . string(s:_function('s:insert_stronger_password')) . ', [])', \ . string(s:_function('s:insert_stronger_password')) . ', [])',
\ 'insert stronger password', 1) \ 'insert stronger password', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 3], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 3], 'call call('
\ . string(s:_function('s:insert_paranoid_password')) . ', [])', \ . string(s:_function('s:insert_paranoid_password')) . ', [])',
\ 'insert password for paranoids', 1) \ 'insert password for paranoids', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'p'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'p'], 'call call('
\ . string(s:_function('s:insert_phonetically_password')) . ', [])', \ . string(s:_function('s:insert_phonetically_password')) . ', [])',
\ 'insert a phonetically easy password', 1) \ 'insert a phonetically easy password', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'n'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'n'], 'call call('
\ . string(s:_function('s:insert_numerical_password')) . ', [])', \ . string(s:_function('s:insert_numerical_password')) . ', [])',
\ 'insert a numerical password', 1) \ 'insert a numerical password', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search and insert unicode', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search and insert unicode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'U', 'U'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'U', 'U'], 'call call('
\ . string(s:_function('s:uuidgen_U')) . ', [])', \ . string(s:_function('s:uuidgen_U')) . ', [])',
\ 'uuidgen-4', 1) \ 'uuidgen-4', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'l'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'l'], 'call call('
\ . string(s:_function('s:insert_lorem_ipsum_list')) . ', [])', \ . string(s:_function('s:insert_lorem_ipsum_list')) . ', [])',
\ 'insert lorem-ipsum list', 1) \ 'insert lorem-ipsum list', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'p'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'p'], 'call call('
\ . string(s:_function('s:insert_lorem_ipsum_paragraph')) . ', [])', \ . string(s:_function('s:insert_lorem_ipsum_paragraph')) . ', [])',
\ 'insert lorem-ipsum paragraph', 1) \ 'insert lorem-ipsum paragraph', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call('
\ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])', \ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])',
\ 'insert lorem-ipsum sentence', 1) \ 'insert lorem-ipsum sentence', 1)
let g:_spacevim_mappings_space.x.g = {'name' : '+translate'} let g:_spacevim_mappings_space.x.g = {'name' : '+translate'}
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1)
" move line " move line
call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call('
\ . string(s:_function('s:move_text_down_transient_state')) . ', [])', \ . string(s:_function('s:move_text_down_transient_state')) . ', [])',
\ 'move text down(enter transient state)', 1) \ 'move text down(enter transient state)', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'K'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 'K'], 'call call('
\ . string(s:_function('s:move_text_up_transient_state')) . ', [])', \ . string(s:_function('s:move_text_up_transient_state')) . ', [])',
\ 'move text up(enter transient state)', 1) \ 'move text up(enter transient state)', 1)
" transpose " transpose
let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'} let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'}
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call('
\ . string(s:_function('s:transpose_with_previous')) . ', ["character"])', \ . string(s:_function('s:transpose_with_previous')) . ', ["character"])',
\ 'swap current character with previous one', 1) \ 'swap current character with previous one', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'w'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'w'], 'call call('
\ . string(s:_function('s:transpose_with_previous')) . ', ["word"])', \ . string(s:_function('s:transpose_with_previous')) . ', ["word"])',
\ 'swap current word with previous one', 1) \ 'swap current word with previous one', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call('
\ . string(s:_function('s:transpose_with_previous')) . ', ["line"])', \ . string(s:_function('s:transpose_with_previous')) . ', ["line"])',
\ 'swap current line with previous one', 1) \ 'swap current line with previous one', 1)
endfunction endfunction
function! s:transpose_with_previous(type) abort function! s:transpose_with_previous(type) abort
if a:type ==# 'line' if a:type ==# 'line'
if line('.') > 1 if line('.') > 1
normal! kddp normal! kddp
endif
elseif a:type ==# 'word'
let save_register = @k
normal! "kyiw
let cw = @k
normal! ge"kyiw
let tw = @k
if cw !=# tw
let @k = cw
normal! viw"kp
let @k = tw
normal! eviw"kp
endif
let @k =save_register
elseif a:type ==# 'character'
if col('.') > 1
let save_register_k = @k
let save_register_m = @m
normal! v"kyhv"myv"kplv"mp
let @k =save_register_k
let @m =save_register_m
endif
endif endif
elseif a:type ==# 'word'
let save_register = @k
normal! "kyiw
let cw = @k
normal! ge"kyiw
let tw = @k
if cw !=# tw
let @k = cw
normal! viw"kp
let @k = tw
normal! eviw"kp
endif
let @k =save_register
elseif a:type ==# 'character'
if col('.') > 1
let save_register_k = @k
let save_register_m = @m
normal! v"kyhv"myv"kplv"mp
let @k =save_register_k
let @m =save_register_m
endif
endif
endfunction endfunction
function! s:move_text_down_transient_state() abort function! s:move_text_down_transient_state() abort
if line('.') == line('$')
else
normal! ddp normal! ddp
call s:text_transient_state() endif
call s:text_transient_state()
endfunction endfunction
function! s:move_text_up_transient_state() abort function! s:move_text_up_transient_state() abort
if line('.') == 1
else
normal! ddkP normal! ddkP
call s:text_transient_state() endif
call s:text_transient_state()
endfunction endfunction
function! s:text_transient_state() abort function! s:text_transient_state() abort
let state = SpaceVim#api#import('transient_state') let state = SpaceVim#api#import('transient_state')
call state.set_title('Move Text Transient State') call state.set_title('Move Text Transient State')
call state.defind_keys( call state.defind_keys(
\ { \ {
\ 'layout' : 'vertical split', \ 'layout' : 'vertical split',
\ 'left' : [ \ 'left' : [
\ { \ {
\ 'key' : 'J', \ 'key' : 'J',
\ 'desc' : 'move text down', \ 'desc' : 'move text down',
\ 'func' : '', \ 'func' : '',
\ 'cmd' : 'normal! "_ddp', \ 'cmd' : 'noautocmd normal! "_ddp',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ ], \ ],
\ 'right' : [ \ 'right' : [
\ { \ {
\ 'key' : 'K', \ 'key' : 'K',
\ 'desc' : 'move text up', \ 'func' : '',
\ 'func' : '', \ 'desc' : 'move text up',
\ 'cmd' : 'normal! "_ddkP', \ 'cmd' : 'noautocmd exe line(".") == 1 ? "" : "normal! \"_ddkP"',
\ 'exit' : 0, \ 'exit' : 0,
\ }, \ },
\ ], \ ],
\ } \ }
\ ) \ )
call state.open() call state.open()
endfunction endfunction
function! s:lowerCamelCase() abort function! s:lowerCamelCase() abort
" fooFzz " fooFzz
let cword = s:parse_symbol(expand('<cword>')) let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword) if !empty(cword)
let rst = [cword[0]] let rst = [cword[0]]
if len(cword) > 1 if len(cword) > 1
let rst += map(cword[1:], "substitute(v:val, '^.', '\\u&', 'g')") let rst += map(cword[1:], "substitute(v:val, '^.', '\\u&', 'g')")
endif
let save_register = @k
let save_cursor = getcurpos()
let @k = join(rst, '')
normal! viw"kp
call setpos('.', save_cursor)
let @k = save_register
endif endif
let save_register = @k
let save_cursor = getcurpos()
let @k = join(rst, '')
normal! viw"kp
call setpos('.', save_cursor)
let @k = save_register
endif
endfunction endfunction
function! s:UpperCamelCase() abort function! s:UpperCamelCase() abort
" FooFzz " FooFzz
let cword = s:parse_symbol(expand('<cword>')) let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword) if !empty(cword)
let rst = map(cword, "substitute(v:val, '^.', '\\u&', 'g')") let rst = map(cword, "substitute(v:val, '^.', '\\u&', 'g')")
let save_register = @k let save_register = @k
let save_cursor = getcurpos() let save_cursor = getcurpos()
let @k = join(rst, '') let @k = join(rst, '')
normal! viw"kp normal! viw"kp
call setpos('.', save_cursor) call setpos('.', save_cursor)
let @k = save_register let @k = save_register
endif endif
endfunction endfunction
function! s:kebab_case() abort function! s:kebab_case() abort
" foo-fzz " foo-fzz
let cword = s:parse_symbol(expand('<cword>')) let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword) if !empty(cword)
let save_register = @k let save_register = @k
let save_cursor = getcurpos() let save_cursor = getcurpos()
let @k = join(cword, '-') let @k = join(cword, '-')
normal! viw"kp normal! viw"kp
call setpos('.', save_cursor) call setpos('.', save_cursor)
let @k = save_register let @k = save_register
endif endif
endfunction endfunction
function! s:under_score() abort function! s:under_score() abort
" foo_fzz " foo_fzz
let cword = s:parse_symbol(expand('<cword>')) let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword) if !empty(cword)
let save_register = @k let save_register = @k
let save_cursor = getcurpos() let save_cursor = getcurpos()
let @k = join(cword, '_') let @k = join(cword, '_')
normal! viw"kp normal! viw"kp
call setpos('.', save_cursor) call setpos('.', save_cursor)
let @k = save_register let @k = save_register
endif endif
endfunction endfunction
function! s:up_case() abort function! s:up_case() abort
" FOO_FZZ " FOO_FZZ
let cword =map(s:parse_symbol(expand('<cword>')), 'toupper(v:val)') let cword =map(s:parse_symbol(expand('<cword>')), 'toupper(v:val)')
if !empty(cword) if !empty(cword)
let save_register = @k let save_register = @k
let save_cursor = getcurpos() let save_cursor = getcurpos()
let @k = join(cword, '_') let @k = join(cword, '_')
normal! viw"kp normal! viw"kp
call setpos('.', save_cursor) call setpos('.', save_cursor)
let @k = save_register let @k = save_register
endif endif
endfunction endfunction
let s:STRING = SpaceVim#api#import('data#string') let s:STRING = SpaceVim#api#import('data#string')
function! s:parse_symbol(symbol) abort function! s:parse_symbol(symbol) abort
if a:symbol =~# '^[a-z]\+\(-[a-zA-Z]\+\)*$' if a:symbol =~# '^[a-z]\+\(-[a-zA-Z]\+\)*$'
return split(a:symbol, '-') return split(a:symbol, '-')
elseif a:symbol =~# '^[a-z]\+\(_[a-zA-Z]\+\)*$' elseif a:symbol =~# '^[a-z]\+\(_[a-zA-Z]\+\)*$'
return split(a:symbol, '_') return split(a:symbol, '_')
elseif a:symbol =~# '^[a-z]\+\([A-Z][a-z]\+\)*$' elseif a:symbol =~# '^[a-z]\+\([A-Z][a-z]\+\)*$'
let chars = s:STRING.string2chars(a:symbol) let chars = s:STRING.string2chars(a:symbol)
let rst = [] let rst = []
let word = '' let word = ''
for char in chars for char in chars
if char =~# '[a-z]' if char =~# '[a-z]'
let word .= char let word .= char
else else
call add(rst, tolower(word))
let word = char
endif
endfor
call add(rst, tolower(word)) call add(rst, tolower(word))
return rst let word = char
elseif a:symbol =~# '^[A-Z][a-z]\+\([A-Z][a-z]\+\)*$' endif
let chars = s:STRING.string2chars(a:symbol) endfor
let rst = [] call add(rst, tolower(word))
let word = '' return rst
for char in chars elseif a:symbol =~# '^[A-Z][a-z]\+\([A-Z][a-z]\+\)*$'
if char =~# '[a-z]' let chars = s:STRING.string2chars(a:symbol)
let word .= char let rst = []
else let word = ''
if !empty(word) for char in chars
call add(rst, tolower(word)) if char =~# '[a-z]'
endif let word .= char
let word = char else
endif if !empty(word)
endfor call add(rst, tolower(word))
call add(rst, tolower(word)) endif
return rst let word = char
else endif
return [a:symbol] endfor
endif call add(rst, tolower(word))
return rst
else
return [a:symbol]
endif
endfunction endfunction
function! s:count_selection_region() abort function! s:count_selection_region() abort
call feedkeys("gvg\<c-g>\<Esc>", 'ti') call feedkeys("gvg\<c-g>\<Esc>", 'ti')
endfunction endfunction
function! s:delete_extra_space() abort function! s:delete_extra_space() abort
if !empty(getline('.')) if !empty(getline('.'))
if getline('.')[col('.')-1] ==# ' ' if getline('.')[col('.')-1] ==# ' '
exe "normal! viw\"_di\<Space>\<Esc>" exe "normal! viw\"_di\<Space>\<Esc>"
endif
endif endif
endif
endfunction endfunction
let s:local_lorem_ipsum = [ let s:local_lorem_ipsum = [
\ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.', \ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.',
\ 'Donec hendrerit tempor tellus.', \ 'Donec hendrerit tempor tellus.',
\ 'Donec pretium posuere tellus.', \ 'Donec pretium posuere tellus.',
\ 'Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.', \ 'Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.',
\ 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.', \ 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.',
\ 'Nulla posuere.', \ 'Nulla posuere.',
\ 'Donec vitae dolor.', \ 'Donec vitae dolor.',
\ 'Nullam tristique diam non turpis.', \ 'Nullam tristique diam non turpis.',
\ 'Cras placerat accumsan nulla.', \ 'Cras placerat accumsan nulla.',
\ 'Nullam rutrum.', \ 'Nullam rutrum.',
\ 'Nam vestibulum accumsan nisl.', \ 'Nam vestibulum accumsan nisl.',
\ 'Pellentesque dapibus suscipit ligula.', \ 'Pellentesque dapibus suscipit ligula.',
\ 'Donec posuere augue in quam.', \ 'Donec posuere augue in quam.',
\ 'Etiam vel tortor sodales tellus ultricies commodo.', \ 'Etiam vel tortor sodales tellus ultricies commodo.',
\ 'Suspendisse potenti.', \ 'Suspendisse potenti.',
\ 'Aenean in sem ac leo mollis blandit.', \ 'Aenean in sem ac leo mollis blandit.',
\ 'Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi.', \ 'Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi.',
\ 'Phasellus lacus.', \ 'Phasellus lacus.',
\ 'Etiam laoreet quam sed arcu.', \ 'Etiam laoreet quam sed arcu.',
\ 'Phasellus at dui in ligula mollis ultricies.', \ 'Phasellus at dui in ligula mollis ultricies.',
\ 'Integer placerat tristique nisl.', \ 'Integer placerat tristique nisl.',
\ 'Praesent augue.', \ 'Praesent augue.',
\ 'Fusce commodo.', \ 'Fusce commodo.',
\ 'Vestibulum convallis, lorem a tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus.', \ 'Vestibulum convallis, lorem a tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus.',
\ 'Nullam libero mauris, consequat quis, varius et, dictum id, arcu.', \ 'Nullam libero mauris, consequat quis, varius et, dictum id, arcu.',
\ 'Mauris mollis tincidunt felis.', \ 'Mauris mollis tincidunt felis.',
\ 'Aliquam feugiat tellus ut neque.', \ 'Aliquam feugiat tellus ut neque.',
\ 'Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus, et dictum nunc justo sit amet elit.', \ 'Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus, et dictum nunc justo sit amet elit.',
\ 'Aliquam erat volutpat.', \ 'Aliquam erat volutpat.',
\ 'Nunc eleifend leo vitae magna.', \ 'Nunc eleifend leo vitae magna.',
\ 'In id erat non orci commodo lobortis.', \ 'In id erat non orci commodo lobortis.',
\ 'Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.', \ 'Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.',
\ 'Sed diam.', \ 'Sed diam.',
\ 'Praesent fermentum tempor tellus.', \ 'Praesent fermentum tempor tellus.',
\ 'Nullam tempus.', \ 'Nullam tempus.',
\ 'Mauris ac felis vel velit tristique imperdiet.', \ 'Mauris ac felis vel velit tristique imperdiet.',
\ 'Donec at pede.', \ 'Donec at pede.',
\ 'Etiam vel neque nec dui dignissim bibendum.', \ 'Etiam vel neque nec dui dignissim bibendum.',
\ 'Vivamus id enim.', \ 'Vivamus id enim.',
\ 'Phasellus neque orci, porta a, aliquet quis, semper a, massa.', \ 'Phasellus neque orci, porta a, aliquet quis, semper a, massa.',
\ 'Phasellus purus.', \ 'Phasellus purus.',
\ 'Pellentesque tristique imperdiet tortor.', \ 'Pellentesque tristique imperdiet tortor.',
\ 'Nam euismod tellus id erat.', \ 'Nam euismod tellus id erat.',
\ 'Nullam eu ante vel est convallis dignissim.', \ 'Nullam eu ante vel est convallis dignissim.',
\ 'Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio.', \ 'Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio.',
\ 'Nunc porta vulputate tellus.', \ 'Nunc porta vulputate tellus.',
\ 'Nunc rutrum turpis sed pede.', \ 'Nunc rutrum turpis sed pede.',
\ 'Sed bibendum.', \ 'Sed bibendum.',
\ 'Aliquam posuere.', \ 'Aliquam posuere.',
\ 'Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi purus non odio.', \ 'Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi purus non odio.',
\ 'Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna.', \ 'Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna.',
\ 'Curabitur vulputate vestibulum lorem.', \ 'Curabitur vulputate vestibulum lorem.',
\ 'Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at vulputate neque nulla lacinia eros.', \ 'Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at vulputate neque nulla lacinia eros.',
\ 'Sed id ligula quis est convallis tempor.', \ 'Sed id ligula quis est convallis tempor.',
\ 'Curabitur lacinia pulvinar nibh.', \ 'Curabitur lacinia pulvinar nibh.',
\ 'Nam a sapien.', \ 'Nam a sapien.',
\ ] \ ]
let s:lorem_ipsum_paragraph_separator = "\n\n" let s:lorem_ipsum_paragraph_separator = "\n\n"
let s:lorem_ipsum_sentence_separator = ' ' let s:lorem_ipsum_sentence_separator = ' '
@ -413,93 +419,93 @@ let s:lorem_ipsum_list_item_end = "\n"
let s:lorem_ipsum_list_end = '' let s:lorem_ipsum_list_end = ''
function! s:insert_lorem_ipsum_list() abort function! s:insert_lorem_ipsum_list() abort
let save_register = @k let save_register = @k
let @k = '* ' . s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . "\n" let @k = '* ' . s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . "\n"
normal! "kgP normal! "kgP
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_lorem_ipsum_paragraph() abort function! s:insert_lorem_ipsum_paragraph() abort
let save_register = @k let save_register = @k
let pids = len(s:local_lorem_ipsum) / 11 let pids = len(s:local_lorem_ipsum) / 11
let pid = s:NUMBER.random(0, pids) * 11 let pid = s:NUMBER.random(0, pids) * 11
let @k = join(s:LIST.listpart(s:local_lorem_ipsum, pid, 11), s:lorem_ipsum_sentence_separator) . s:lorem_ipsum_paragraph_separator let @k = join(s:LIST.listpart(s:local_lorem_ipsum, pid, 11), s:lorem_ipsum_sentence_separator) . s:lorem_ipsum_paragraph_separator
normal! "kgP normal! "kgP
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_lorem_ipsum_sentence() abort function! s:insert_lorem_ipsum_sentence() abort
let save_register = @k let save_register = @k
let @k = s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . s:lorem_ipsum_sentence_separator let @k = s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . s:lorem_ipsum_sentence_separator
normal! "kgP normal! "kgP
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_simple_password() abort function! s:insert_simple_password() abort
let save_register = @k let save_register = @k
let @k = s:PASSWORD.generate_simple(8) let @k = s:PASSWORD.generate_simple(8)
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_stronger_password() abort function! s:insert_stronger_password() abort
let save_register = @k let save_register = @k
let @k = s:PASSWORD.generate_strong(12) let @k = s:PASSWORD.generate_strong(12)
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_paranoid_password() abort function! s:insert_paranoid_password() abort
let save_register = @k let save_register = @k
let @k = s:PASSWORD.generate_paranoid(20) let @k = s:PASSWORD.generate_paranoid(20)
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_numerical_password() abort function! s:insert_numerical_password() abort
let save_register = @k let save_register = @k
let @k = s:PASSWORD.generate_numeric(4) let @k = s:PASSWORD.generate_numeric(4)
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
function! s:insert_phonetically_password() abort function! s:insert_phonetically_password() abort
let save_register = @k let save_register = @k
let @k = s:PASSWORD.generate_phonetic(8) let @k = s:PASSWORD.generate_phonetic(8)
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
function! s:uuidgen_U() abort function! s:uuidgen_U() abort
let uuid = system('uuidgen') let uuid = system('uuidgen')
let save_register = @k let save_register = @k
let @k = uuid let @k = uuid
normal! "kPl normal! "kPl
let @k = save_register let @k = save_register
endfunction endfunction
" function() wrapper " function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170') if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort function! s:_function(fstr) abort
return function(a:fstr) return function(a:fstr)
endfunction endfunction
else else
function! s:_SID() abort function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction endfunction
let s:_s = '<SNR>' . s:_SID() . '_' let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g')) return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction endfunction
endif endif
augroup spacevim_layer_edit augroup spacevim_layer_edit
au! au!
autocmd BufNewFile *.py call <SID>add_buffer_head() autocmd BufNewFile *.py call <SID>add_buffer_head()
augroup END augroup END
let s:ft_head_tp = {} let s:ft_head_tp = {}
function! s:add_buffer_head() abort function! s:add_buffer_head() abort
if has_key(s:ft_head_tp, &ft) if has_key(s:ft_head_tp, &ft)
call setline(1, s:ft_head_tp[&ft]) call setline(1, s:ft_head_tp[&ft])
endif endif
endfunction endfunction
function! SpaceVim#layers#edit#add_ft_head_tamplate(ft, tamp) function! SpaceVim#layers#edit#add_ft_head_tamplate(ft, tamp)
call extend(s:ft_head_tp, {a:ft : a:tamp}) call extend(s:ft_head_tp, {a:ft : a:tamp})
endfunction endfunction

View File

@ -42,6 +42,7 @@ function! SpaceVim#layers#git#config() abort
autocmd! autocmd!
autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR> autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR>
autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete
autocmd User GitGutter let &l:statusline = SpaceVim#layers#core#statusline#get(1)
augroup END augroup END
call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call('
\ . string(function('s:display_last_commit_of_current_line')) . ', [])', \ . string(function('s:display_last_commit_of_current_line')) . ', [])',

View File

@ -40,10 +40,16 @@
let s:use_libclang = 0
function! SpaceVim#layers#lang#c#plugins() abort function! SpaceVim#layers#lang#c#plugins() abort
let plugins = [] let plugins = []
if has('nvim') if has('nvim')
call add(plugins, ['tweekmonster/deoplete-clang2']) if s:use_libclang
call add(plugins, ['zchee/deoplete-clang'])
else
call add(plugins, ['tweekmonster/deoplete-clang2'])
endif
else else
call add(plugins, ['Rip-Rip/clang_complete']) call add(plugins, ['Rip-Rip/clang_complete'])
endif endif
@ -56,6 +62,18 @@ function! SpaceVim#layers#lang#c#config() abort
call SpaceVim#mapping#space#regesit_lang_mappings('c', funcref('s:language_specified_mappings')) call SpaceVim#mapping#space#regesit_lang_mappings('c', funcref('s:language_specified_mappings'))
endfunction endfunction
function! SpaceVim#layers#lang#c#set_variable(var) abort
" use clang or libclang
let s:use_libclang = get(a:var,
\ 'use_libclang',
\ 'clang')
if has_key(a:var, 'clang_executable')
let g:completor_clang_binary = a:var.clang_executable
let g:deoplete#sources#clang#executable = a:var.clang_executable
endif
endfunction
function! s:language_specified_mappings() abort function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],

View File

@ -1,23 +1,56 @@
function! SpaceVim#layers#lang#haskell#plugins() abort function! SpaceVim#layers#lang#haskell#plugins() abort
let plugins = [] let plugins = [
call add(plugins,['neovimhaskell/haskell-vim', { 'on_ft' : 'haskell'}]) \ ['neovimhaskell/haskell-vim', { 'on_ft': 'haskell' }],
call add(plugins,['pbrisbin/vim-syntax-shakespeare', { 'on_ft' : 'haskell'}]) \ ['pbrisbin/vim-syntax-shakespeare', { 'on_ft': 'haskell' }],
call add(plugins,['eagletmt/neco-ghc', { 'on_ft' : 'haskell'}]) \ ]
return plugins
if !s:use_lsp
call add(plugins, ['eagletmt/neco-ghc', { 'on_ft': 'haskell' }])
endif
return plugins
endfunction
let s:use_lsp = 0
function! SpaceVim#layers#lang#haskell#set_variable(var) abort
let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim') && executable('hie')
endfunction endfunction
function! SpaceVim#layers#lang#haskell#config() abort function! SpaceVim#layers#lang#haskell#config() abort
let g:haskellmode_completion_ghc = 0 let g:haskellmode_completion_ghc = 0
call SpaceVim#plugins#runner#reg_runner('haskell', ['ghc -v0 --make %s -o #TEMP#', '#TEMP#']) call SpaceVim#plugins#runner#reg_runner('haskell', [
call SpaceVim#mapping#space#regesit_lang_mappings('haskell', funcref('s:language_specified_mappings')) \ 'ghc -v0 --make %s -o #TEMP#',
\ '#TEMP#'])
call SpaceVim#mapping#space#regesit_lang_mappings('haskell',
\ funcref('s:on_ft'))
if s:use_lsp
call SpaceVim#mapping#gd#add('haskell',
\ function('SpaceVim#lsp#go_to_def'))
call SpaceVim#lsp#reg_server('haskell', ['hie', '--lsp'])
endif
augroup SpaceVim_lang_haskell augroup SpaceVim_lang_haskell
autocmd! autocmd!
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
if !s:use_lsp
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
endif
augroup END augroup END
endfunction endfunction
function! s:language_specified_mappings() abort function! s:on_ft() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) if s:use_lsp
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
endif
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'],
\ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
endfunction endfunction

View File

@ -5,22 +5,30 @@ function! SpaceVim#layers#lang#javascript#plugins() abort
\ ['othree/es.next.syntax.vim', { 'on_ft' : 'javascript' }], \ ['othree/es.next.syntax.vim', { 'on_ft' : 'javascript' }],
\ ['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript', 'coffee', 'ls', 'typescript'] }], \ ['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript', 'coffee', 'ls', 'typescript'] }],
\ ['MaxMEllon/vim-jsx-pretty', { 'on_ft' : 'javascript' }], \ ['MaxMEllon/vim-jsx-pretty', { 'on_ft' : 'javascript' }],
\ ['ternjs/tern_for_vim', { 'on_ft' : 'javascript', 'build' : 'npm install' }],
\ ['Galooshi/vim-import-js', { 'on_ft' : 'javascript', 'build' : 'npm install -g import-js' }], \ ['Galooshi/vim-import-js', { 'on_ft' : 'javascript', 'build' : 'npm install -g import-js' }],
\ ['maksimr/vim-jsbeautify', { 'on_ft' : 'javascript' }], \ ['maksimr/vim-jsbeautify', { 'on_ft' : 'javascript' }],
\ ['mmalecki/vim-node.js', { 'on_ft' : 'javascript' }], \ ['mmalecki/vim-node.js', { 'on_ft' : 'javascript' }],
\ ] \ ]
if has('nvim') if !s:use_lsp
call add(plugins,['carlitux/deoplete-ternjs', { 'on_ft' : ['javascript'] }]) call add(plugins, ['ternjs/tern_for_vim', {
\ 'on_ft': 'javascript', 'build' : 'npm install' }])
if has('nvim')
call add(plugins, ['carlitux/deoplete-ternjs', { 'on_ft': [
\ 'javascript'] }])
endif
endif endif
return plugins return plugins
endfunction endfunction
let s:use_lsp = 0
let s:auto_fix = 0 let s:auto_fix = 0
function! SpaceVim#layers#lang#javascript#set_variable(var) abort function! SpaceVim#layers#lang#javascript#set_variable(var) abort
let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim')
\ && executable('javascript-typescript-stdio')
let s:auto_fix = get(a:var, 'auto_fix', 0) let s:auto_fix = get(a:var, 'auto_fix', 0)
endfunction endfunction
@ -34,9 +42,17 @@ function! SpaceVim#layers#lang#javascript#config() abort
let g:vim_jsx_pretty_colorful_config = 1 let g:vim_jsx_pretty_colorful_config = 1
" }}} " }}}
call SpaceVim#mapping#gd#add('javascript', function('s:gotodef'))
call SpaceVim#plugins#runner#reg_runner('javascript', 'node %s') call SpaceVim#plugins#runner#reg_runner('javascript', 'node %s')
call SpaceVim#mapping#space#regesit_lang_mappings('javascript', funcref('s:language_specified_mappings')) call SpaceVim#mapping#space#regesit_lang_mappings('javascript',
\ funcref('s:on_ft'))
if s:use_lsp
call SpaceVim#lsp#reg_server('javascript', ['javascript-typescript-stdio'])
call SpaceVim#mapping#gd#add('javascript',
\ function('SpaceVim#lsp#go_to_def'))
else
call SpaceVim#mapping#gd#add('javascript', function('s:tern_go_to_def'))
endif
if s:auto_fix if s:auto_fix
" Only use eslint " Only use eslint
@ -52,12 +68,7 @@ function! SpaceVim#layers#lang#javascript#config() abort
endif endif
endfunction endfunction
function! s:language_specified_mappings() abort function! s:on_ft() abort
" ternjs/tern_for_vim {{{
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TernDoc', 'Look up the documentation of something', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], 'TernRename', 'Rename the variable under the cursor', 1)
" }}}
" Galooshi/vim-import-js {{{ " Galooshi/vim-import-js {{{
nnoremap <silent><buffer> <F4> :ImportJSWord<CR> nnoremap <silent><buffer> <F4> :ImportJSWord<CR>
nnoremap <silent><buffer> <Leader>ji :ImportJSWord<CR> nnoremap <silent><buffer> <Leader>ji :ImportJSWord<CR>
@ -70,14 +81,28 @@ function! s:language_specified_mappings() abort
inoremap <silent><buffer> <C-j>g <Esc>:ImportJSGoto<CR>a inoremap <silent><buffer> <C-j>g <Esc>:ImportJSGoto<CR>a
" }}} " }}}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) if s:use_lsp
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
else
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TernDoc',
\ 'show document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], 'TernRename',
\ 'rename symbol', 1)
endif
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'],
\ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
endfunction endfunction
function! s:gotodef() abort function! s:tern_go_to_def() abort
if exists(':TernDef') if exists(':TernDef')
TernDef TernDef
endif endif
endfunction endfunction
" vi: et sw=2 cc=80
" vim:set et sw=2 cc=80:

View File

@ -1,7 +1,12 @@
function! SpaceVim#layers#lang#javascript#plugins() abort function! SpaceVim#layers#lang#sh#plugins() abort
return [ let l:plugins = []
\ ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }] call add(l:plugins, ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }])
\ ] if get(g:, 'spacevim_enable_ycm') == 1
call add(l:plugins, ['Valodim/vim-zsh-completion', { 'on_ft' : 'zsh' }])
else
call add(l:plugins, ['zchee/deoplete-zsh', { 'on_ft' : 'zsh' }])
endif
return l:plugins
endfunction endfunction
function! SpaceVim#layers#lang#sh#config() function! SpaceVim#layers#lang#sh#config()

View File

@ -58,7 +58,7 @@ function! SpaceVim#layers#lsp#config() abort
let g:LanguageClient_diagnosticsDisplay[4].signTexthl = 'ALEInfoSign' let g:LanguageClient_diagnosticsDisplay[4].signTexthl = 'ALEInfoSign'
endif endif
let g:LanguageClient_autoStart = 0 let g:LanguageClient_autoStart = 1
" }}} " }}}
endfunction endfunction

View File

@ -69,7 +69,7 @@ function! s:open_default_shell() abort
if has('nvim') if has('nvim')
exe 'terminal' exe 'terminal'
else else
call term_start('bash', {'curwin' : 1, 'term_finish' : 'close'}) call term_start($SHELL, {'curwin' : 1, 'term_finish' : 'close'})
endif endif
let s:shell_win_nr = winnr() let s:shell_win_nr = winnr()
let w:shell_layer_win = 1 let w:shell_layer_win = 1

View File

@ -73,25 +73,9 @@ function! SpaceVim#layers#tools#config() abort
endif endif
map <Leader>td <Plug>TaskList map <Leader>td <Plug>TaskList
noremap <silent> <F8> :TlistToggle<CR> noremap <silent> <F8> :TlistToggle<CR>
function! OpenOrCloseNERDTree() abort
exec 'normal! A'
endfunction
if g:spacevim_filemanager ==# 'nerdtree' if g:spacevim_filemanager ==# 'nerdtree'
noremap <silent> <F3> :NERDTreeToggle<CR> noremap <silent> <F3> :NERDTreeToggle<CR>
endif endif
let g:NERDTreeWinPos=get(g:,'NERDTreeWinPos','right')
let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31)
let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1)
augroup nerdtree_zvim
autocmd!
autocmd bufenter *
\ if (winnr('$') == 1 && exists('b:NERDTree')
\ && b:NERDTree.isTabTree())
\| q
\| endif
autocmd FileType nerdtree nnoremap <silent><buffer><Space>
\ :call OpenOrCloseNERDTree()<cr>
augroup END
endfunction endfunction
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80:

View File

@ -26,7 +26,7 @@ function! SpaceVim#layers#ui#config() abort
let g:indentLine_char = get(g:, 'indentLine_char', '¦') let g:indentLine_char = get(g:, 'indentLine_char', '¦')
let g:indentLine_concealcursor = 'niv' let g:indentLine_concealcursor = 'niv'
let g:indentLine_conceallevel = 2 let g:indentLine_conceallevel = 2
let g:indentLine_fileTypeExclude = ['help', 'startify', 'vimfiler'] let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler']
let g:signify_disable_by_default = 0 let g:signify_disable_by_default = 0
let g:signify_line_highlight = 0 let g:signify_line_highlight = 0
noremap <silent> <F2> :silent TagbarToggle<CR> noremap <silent> <F2> :silent TagbarToggle<CR>

22
autoload/SpaceVim/lsp.vim Normal file
View File

@ -0,0 +1,22 @@
scriptencoding utf-8
" lsp.vim
" author: Seong Yong-ju ( @sei40kr )
function! SpaceVim#lsp#reg_server(ft, cmds) abort
let g:LanguageClient_serverCommands[a:ft] = copy(a:cmds)
endfunction
function! SpaceVim#lsp#show_doc() abort
call LanguageClient_textDocument_hover()
endfunction
function! SpaceVim#lsp#go_to_def() abort
call LanguageClient_textDocument_definition()
endfunction
function! SpaceVim#lsp#rename() abort
call LanguageClient_textDocument_rename()
endfunction
" vi: et sw=2 cc=80

View File

@ -79,9 +79,15 @@ function! SpaceVim#mapping#def(type, key, value, ...) abort
endif endif
endfunction endfunction
function! SpaceVim#mapping#shift_tab() abort if g:spacevim_snippet_engine ==# 'neosnippet'
return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab" function! SpaceVim#mapping#shift_tab() abort
endfunction return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab"
endfunction
elseif g:spacevim_snippet_engine ==# 'ultisnips'
function! SpaceVim#mapping#shift_tab() abort
return pumvisible() ? "\<C-p>" : "\<C-R>=UltiSnips#JumpForwards()\<CR>\<C-R>=cmp#ultisnips#JumpForward()\<CR>"
endfunction
endif
function! SpaceVim#mapping#tab() abort function! SpaceVim#mapping#tab() abort
return SpaceVim#mapping#tab#i_tab() return SpaceVim#mapping#tab#i_tab()

View File

@ -17,6 +17,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.w = {'name' : '+Windows'} let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
let g:_spacevim_mappings_space.p = {'name' : '+Projects'} let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
let g:_spacevim_mappings_space.h = {'name' : '+Help'} let g:_spacevim_mappings_space.h = {'name' : '+Help'}
let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'}
let g:_spacevim_mappings_space.q = {'name' : '+Quit'} let g:_spacevim_mappings_space.q = {'name' : '+Quit'}
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
let g:_spacevim_mappings_space.s = {'name' : '+Searching'} let g:_spacevim_mappings_space.s = {'name' : '+Searching'}

View File

@ -20,9 +20,23 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
endif endif
endfunction endfunction
elseif g:spacevim_snippet_engine ==# 'ultisnips' elseif g:spacevim_snippet_engine ==# 'ultisnips'
function! SpaceVim#mapping#tab#expandable()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
elseif pumvisible()
return "\<C-n>"
else
return "\<TAB>"
endif
endfunction
function! SpaceVim#mapping#tab#i_tab() abort function! SpaceVim#mapping#tab#i_tab() abort
return "\<tab>" if getline('.')[col('.')-2] ==# '{'&& pumvisible()
return "\<C-n>"
endif
return "\<C-R>=SpaceVim#mapping#tab#expandable()\<cr>"
endfunction endfunction
endif endif
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80:

View File

@ -5,15 +5,15 @@ let s:grepid = 0
function! SpaceVim#plugins#flygrep#open() abort function! SpaceVim#plugins#flygrep#open() abort
rightbelow split __flygrep__ rightbelow split __flygrep__
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
let save_tve = &t_ve let save_tve = &t_ve
setlocal t_ve= setlocal t_ve=
" setlocal nomodifiable " setlocal nomodifiable
setf SpaceVimFlyGrep setf SpaceVimFlyGrep
redraw! redraw!
call s:MPT.open() call s:MPT.open()
let &t_ve = save_tve let &t_ve = save_tve
endfunction endfunction
let s:grep_expr = '' let s:grep_expr = ''
@ -22,53 +22,53 @@ let s:grep_timer_id = 0
" @vimlint(EVL103, 1, a:timer) " @vimlint(EVL103, 1, a:timer)
function! s:grep_timer(timer) abort function! s:grep_timer(timer) abort
let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), { let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), {
\ 'on_stdout' : function('s:grep_stdout'), \ 'on_stdout' : function('s:grep_stdout'),
\ 'in_io' : 'null', \ 'in_io' : 'null',
\ 'on_exit' : function('s:grep_exit'), \ 'on_exit' : function('s:grep_exit'),
\ }) \ })
endfunction endfunction
" @vimlint(EVL103, 0, a:timer) " @vimlint(EVL103, 0, a:timer)
function! s:flygrep(expr) abort function! s:flygrep(expr) abort
call s:MPT._build_prompt() call s:MPT._build_prompt()
if a:expr ==# '' if a:expr ==# ''
redrawstatus redrawstatus
return return
endif endif
try try
syn clear FileNames call matchdelete(s:hi_id)
catch catch
endtr endtr
exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/' hi def link FileNames MoreMsg
hi def link FileNames MoreMsg let s:hi_id = matchadd('FileNames', a:expr, 1)
let s:grep_expr = a:expr let s:grep_expr = a:expr
let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1})
endfunction endfunction
let s:MPT._handle_fly = function('s:flygrep') let s:MPT._handle_fly = function('s:flygrep')
function! s:close_buffer() abort function! s:close_buffer() abort
if s:grepid != 0 if s:grepid != 0
call s:JOB.stop(s:grepid) call s:JOB.stop(s:grepid)
endif endif
if s:grep_timer_id != 0 if s:grep_timer_id != 0
call timer_stop(s:grep_timer_id) call timer_stop(s:grep_timer_id)
endif endif
q q
endfunction endfunction
let s:MPT._onclose = function('s:close_buffer') let s:MPT._onclose = function('s:close_buffer')
function! s:close_grep_job() abort function! s:close_grep_job() abort
if s:grepid != 0 if s:grepid != 0
call s:JOB.stop(s:grepid) call s:JOB.stop(s:grepid)
endif endif
if s:grep_timer_id != 0 if s:grep_timer_id != 0
call timer_stop(s:grep_timer_id) call timer_stop(s:grep_timer_id)
endif endif
normal! "_ggdG normal! "_ggdG
endfunction endfunction
let s:MPT._oninputpro = function('s:close_grep_job') let s:MPT._oninputpro = function('s:close_grep_job')
@ -77,18 +77,18 @@ let s:MPT._oninputpro = function('s:close_grep_job')
" @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)')
if getline(1) ==# '' if getline(1) ==# ''
call setline(1, datas) call setline(1, datas)
else else
call append('$', datas) call append('$', datas)
endif endif
call s:MPT._build_prompt() call s:MPT._build_prompt()
endfunction endfunction
function! s:grep_exit(id, data, event) abort function! s:grep_exit(id, data, event) abort
redrawstatus redrawstatus
let s:grepid = 0 let s:grepid = 0
endfunction endfunction
" @vimlint(EVL103, 0, a:data) " @vimlint(EVL103, 0, a:data)
@ -96,98 +96,113 @@ endfunction
" @vimlint(EVL103, 0, a:event) " @vimlint(EVL103, 0, a:event)
function! s:get_search_cmd(exe, expr) abort function! s:get_search_cmd(exe, expr) abort
if a:exe ==# 'grep' if a:exe ==# 'grep'
return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.'] return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.']
elseif a:exe ==# 'rg' elseif a:exe ==# 'rg'
return ['rg', '-n', '-i', a:expr] return ['rg', '-n', '-i', a:expr]
else else
return [a:exe, a:expr] return [a:exe, a:expr]
endif endif
endfunction endfunction
function! s:next_item() abort function! s:next_item() abort
if line('.') == line('$') if line('.') == line('$')
normal! gg normal! gg
else else
normal! j normal! j
endif endif
redrawstatus redrawstatus
call s:MPT._build_prompt() call s:MPT._build_prompt()
endfunction endfunction
function! s:previous_item() abort function! s:previous_item() abort
if line('.') == 1 if line('.') == 1
normal! G normal! G
else else
normal! k normal! k
endif endif
redrawstatus redrawstatus
call s:MPT._build_prompt() call s:MPT._build_prompt()
endfunction endfunction
function! s:open_item() abort function! s:open_item() abort
if getline('.') !=# '' if getline('.') !=# ''
if s:grepid != 0 if s:grepid != 0
call s:JOB.stop(s:grepid) call s:JOB.stop(s:grepid)
endif
call s:MPT._clear_prompt()
let s:MPT._quit = 1
let line = getline('.')
let filename = fnameescape(split(line, ':\d\+:')[0])
let linenr = matchstr(line, ':\d\+:')[1:-2]
q
exe 'e ' . filename
exe linenr
endif endif
call s:MPT._clear_prompt()
let s:MPT._quit = 1
let line = getline('.')
let filename = fnameescape(split(line, ':\d\+:')[0])
let linenr = matchstr(line, ':\d\+:')[1:-2]
q
exe 'e ' . filename
exe linenr
endif
endfunction endfunction
function! s:double_click() abort function! s:double_click() abort
if line('.') !=# '' if line('.') !=# ''
if s:grepid != 0 if s:grepid != 0
call s:JOB.stop(s:grepid) call s:JOB.stop(s:grepid)
endif
call s:MPT._clear_prompt()
let s:MPT._quit = 1
let isfname = &isfname
if s:SYS.isWindows
set isfname-=:
endif
normal! gF
let nr = bufnr('%')
q
exe 'silent b' . nr
normal! :
let &isfname = isfname
endif endif
call s:MPT._clear_prompt()
let s:MPT._quit = 1
let isfname = &isfname
if s:SYS.isWindows
set isfname-=:
endif
normal! gF
let nr = bufnr('%')
q
exe 'silent b' . nr
normal! :
let &isfname = isfname
endif
endfunction endfunction
function! s:move_cursor() abort function! s:move_cursor() abort
if v:mouse_win == winnr() if v:mouse_win == winnr()
let cl = line('.') let cl = line('.')
if cl < v:mouse_lnum if cl < v:mouse_lnum
exe 'normal! ' . (v:mouse_lnum - cl) . 'j' exe 'normal! ' . (v:mouse_lnum - cl) . 'j'
elseif cl > v:mouse_lnum elseif cl > v:mouse_lnum
exe 'normal! ' . (cl - v:mouse_lnum) . 'k' exe 'normal! ' . (cl - v:mouse_lnum) . 'k'
endif
endif endif
call s:MPT._build_prompt() endif
call s:MPT._build_prompt()
endfunction endfunction
let s:MPT._function_key = { let s:MPT._function_key = {
\ "\<Tab>" : function('s:next_item'), \ "\<Tab>" : function('s:next_item'),
\ "\<ScrollWheelDown>" : function('s:next_item'), \ "\<ScrollWheelDown>" : function('s:next_item'),
\ "\<S-tab>" : function('s:previous_item'), \ "\<S-tab>" : function('s:previous_item'),
\ "\<ScrollWheelUp>" : function('s:previous_item'), \ "\<ScrollWheelUp>" : function('s:previous_item'),
\ "\<Return>" : function('s:open_item'), \ "\<Return>" : function('s:open_item'),
\ "\<LeftMouse>" : function('s:move_cursor'), \ "\<LeftMouse>" : function('s:move_cursor'),
\ "\<2-LeftMouse>" : function('s:double_click'), \ "\<2-LeftMouse>" : function('s:double_click'),
\ } \ }
if has('nvim')
call extend(s:MPT._function_key,
\ {
\ "\x80\xfdJ" : function('s:previous_item'),
\ "\x80\xfc \x80\xfdJ" : function('s:previous_item'),
\ "\x80\xfc@\x80\xfdJ" : function('s:previous_item'),
\ "\x80\xfc`\x80\xfdJ" : function('s:previous_item'),
\ "\x80\xfdK" : function('s:next_item'),
\ "\x80\xfc \x80\xfdK" : function('s:next_item'),
\ "\x80\xfc@\x80\xfdK" : function('s:next_item'),
\ "\x80\xfc`\x80\xfdK" : function('s:next_item'),
\ }
\ )
endif
" statusline api " statusline api
function! SpaceVim#plugins#flygrep#lineNr() abort function! SpaceVim#plugins#flygrep#lineNr() abort
if getline(1) ==# '' if getline(1) ==# ''
return '' return ''
else else
return line('.') . '/' . line('$') return line('.') . '/' . line('$')
endif endif
endfunction endfunction

View File

@ -232,6 +232,7 @@ endfunction
" here if a:data == 0, git pull succeed " here if a:data == 0, git pull succeed
function! s:on_pull_exit(id, data, event) abort function! s:on_pull_exit(id, data, event) abort
call SpaceVim#logger#info(string(a:data))
if a:id == -1 if a:id == -1
let id = s:jobpid let id = s:jobpid
else else
@ -287,6 +288,7 @@ endfunction
" @vimlint(EVL103, 1, a:event) " @vimlint(EVL103, 1, a:event)
function! s:on_install_stdout(id, data, event) abort function! s:on_install_stdout(id, data, event) abort
call SpaceVim#logger#info(string(a:data))
if a:id == -1 if a:id == -1
let id = s:jobpid let id = s:jobpid
else else
@ -302,7 +304,7 @@ endfunction
" @vimlint(EVL103, 0, a:event) " @vimlint(EVL103, 0, a:event)
function! s:lock_revision(repo) abort function! s:lock_revision(repo) abort
let cmd = ['git', '-C', a:repo.path, 'checkout', a:repo.rev] let cmd = ['git', '--git-dir', a:repo.path . '/.git', 'checkout', a:repo.rev]
call s:VIM_CO.system(cmd) call s:VIM_CO.system(cmd)
endfunction endfunction
@ -356,7 +358,8 @@ endfunction
function! s:pull(repo) abort function! s:pull(repo) abort
let s:pct += 1 let s:pct += 1
let s:ui_buf[a:repo.name] = s:pct let s:ui_buf[a:repo.name] = s:pct
let argv = ['git', '-C', a:repo.path, 'pull', '--progress'] let argv = ['git', '--git-dir', a:repo.path . '/.git', '--work-tree', a:repo.path, 'pull', '--progress']
call SpaceVim#logger#info('plugin manager cmd: ' . string(argv))
if s:JOB.vim_job || s:JOB.nvim_job if s:JOB.vim_job || s:JOB.nvim_job
let jobid = s:JOB.start(argv,{ let jobid = s:JOB.start(argv,{
\ 'on_stderr' : function('s:on_install_stdout'), \ 'on_stderr' : function('s:on_install_stdout'),

View File

@ -10,6 +10,7 @@ let s:JOB = SpaceVim#api#import('job')
let s:BUFFER = SpaceVim#api#import('vim#buffer') let s:BUFFER = SpaceVim#api#import('vim#buffer')
let s:STRING = SpaceVim#api#import('data#string') let s:STRING = SpaceVim#api#import('data#string')
let s:runners = {} let s:runners = {}
let s:bufnr = 0 let s:bufnr = 0
@ -33,6 +34,8 @@ let s:target = ''
function! s:async_run(runner) abort function! s:async_run(runner) abort
if type(a:runner) == type('') if type(a:runner) == type('')
let cmd = printf(a:runner, bufname('%')) let cmd = printf(a:runner, bufname('%'))
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[Running] ' . cmd, '', repeat('-', 20)])
let s:lines += 3
let s:start_time = reltime() let s:start_time = reltime()
let s:job_id = s:JOB.start(cmd,{ let s:job_id = s:JOB.start(cmd,{
\ 'on_stdout' : function('s:on_stdout'), \ 'on_stdout' : function('s:on_stdout'),
@ -42,6 +45,12 @@ function! s:async_run(runner) abort
elseif type(a:runner) == type([]) elseif type(a:runner) == type([])
let s:target = tempname() let s:target = tempname()
let compile_cmd = substitute(printf(a:runner[0], bufname('%')), '#TEMP#', s:target, 'g') let compile_cmd = substitute(printf(a:runner[0], bufname('%')), '#TEMP#', s:target, 'g')
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, [
\ '[Compile] ' . compile_cmd,
\ '[Running] ' . s:target,
\ '',
\ repeat('-', 20)])
let s:lines += 4
let s:start_time = reltime() let s:start_time = reltime()
let s:job_id = s:JOB.start(compile_cmd,{ let s:job_id = s:JOB.start(compile_cmd,{
\ 'on_stdout' : function('s:on_stdout'), \ 'on_stdout' : function('s:on_stdout'),
@ -58,6 +67,13 @@ function! s:on_compile_exit(id, data, event) abort
\ 'on_stderr' : function('s:on_stderr'), \ 'on_stderr' : function('s:on_stderr'),
\ 'on_exit' : function('s:on_exit'), \ 'on_exit' : function('s:on_exit'),
\ }) \ })
else
let s:end_time = reltime(s:start_time)
let s:status.is_exit = 1
let s:status.exit_code = a:data
let done = ['', '[Done] exited with code=' . a:data . ' in ' . s:STRING.trim(reltimestr(s:end_time)) . ' seconds']
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done)
call s:update_statusline()
endif endif
endfunction endfunction
@ -84,27 +100,67 @@ function! SpaceVim#plugins#runner#open() abort
call s:update_statusline() call s:update_statusline()
endif endif
endfunction endfunction
" @vimlint(EVL103, 1, a:job_id) " @vimlint(EVL103, 1, a:job_id)
" @vimlint(EVL103, 1, a:data) " @vimlint(EVL103, 1, a:data)
" @vimlint(EVL103, 1, a:event) " @vimlint(EVL103, 1, a:event)
function! s:on_stdout(job_id, data, event) abort
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
call s:update_statusline()
endfunction
function! s:on_stderr(job_id, data, event) abort if has('nvim') && exists('*chanclose')
let s:status.has_errors = 1 let s:_out_data = ['']
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) function! s:on_stdout(job_id, data, event) abort
let s:lines += len(a:data) let s:_out_data[-1] .= a:data[0]
call s:update_statusline() call extend(s:_out_data, a:data[1:])
endfunction if s:_out_data[-1] == ''
call remove(s:_out_data, -1)
let lines = s:_out_data
else
let lines = s:_out_data
endif
if !empty(lines)
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
endif
let s:lines += len(lines)
let s:_out_data = ['']
call s:update_statusline()
endfunction
let s:_err_data = ['']
function! s:on_stderr(job_id, data, event) abort
let s:_out_data[-1] .= a:data[0]
call extend(s:_out_data, a:data[1:])
if s:_out_data[-1] == ''
call remove(s:_out_data, -1)
let lines = s:_out_data
else
let lines = s:_out_data
endif
if !empty(lines)
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
endif
let s:lines += len(lines)
let s:_out_data = ['']
call s:update_statusline()
endfunction
else
function! s:on_stdout(job_id, data, event) abort
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
call s:update_statusline()
endfunction
function! s:on_stderr(job_id, data, event) abort
let s:status.has_errors = 1
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
call s:update_statusline()
endfunction
endif
function! s:on_exit(job_id, data, event) abort function! s:on_exit(job_id, data, event) abort
let s:end_time = reltime(s:start_time) let s:end_time = reltime(s:start_time)
let s:status.is_exit = 1 let s:status.is_exit = 1
let s:status.exit_code = a:data let s:status.exit_code = a:data
let done = ['', '[Done] exited with code=' . a:data . ' in ' . s:STRING.trim(reltimestr(s:end_time)) . ' seconds']
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done)
call s:update_statusline() call s:update_statusline()
endfunction endfunction

View File

@ -277,7 +277,7 @@ fu! zvim#util#Generate_ignore(ignore,tool, ...) abort
if a:tool ==# 'ag' if a:tool ==# 'ag'
for ig in split(a:ignore,',') for ig in split(a:ignore,',')
call add(ignore, '--ignore') call add(ignore, '--ignore')
call add(ignore, ig ) call add(ignore, "'" . ig . "'")
endfor endfor
elseif a:tool ==# 'rg' elseif a:tool ==# 'rg'
for ig in split(a:ignore,',') for ig in split(a:ignore,',')

View File

@ -85,6 +85,9 @@ let g:deoplete#ignore_sources.c = get(g:deoplete#ignore_sources, 'c', ['omni'])
let g:deoplete#ignore_sources.rust = get(g:deoplete#ignore_sources, 'rust', ['omni']) let g:deoplete#ignore_sources.rust = get(g:deoplete#ignore_sources, 'rust', ['omni'])
call deoplete#custom#set('racer', 'mark', '') call deoplete#custom#set('racer', 'mark', '')
" vim
let g:deoplete#ignore_sources.vim = get(g:deoplete#ignore_sources, 'vim', ['tag'])
" clojure " clojure
let g:deoplete#keyword_patterns.clojure = '[\w!$%&*+/:<=>?@\^_~\-\.#]*' let g:deoplete#keyword_patterns.clojure = '[\w!$%&*+/:<=>?@\^_~\-\.#]*'

View File

@ -0,0 +1,41 @@
let s:VCOP = SpaceVim#api#import('vim#compatible')
let g:NERDTreeWinPos=get(g:,'NERDTreeWinPos','right')
let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31)
let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1)
augroup nerdtree_zvim
autocmd!
autocmd bufenter *
\ if (winnr('$') == 1 && exists('b:NERDTree')
\ && b:NERDTree.isTabTree())
\| q
\| endif
autocmd FileType nerdtree call s:nerdtreeinit()
augroup END
function! s:nerdtreeinit() abort
nnoremap <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR>
nnoremap <silent><buffer> P :<C-u>call <SID>paste_to_file_manager()<CR>
endfunction
function! s:paste_to_file_manager() abort
let path = g:NERDTreeFileNode.GetSelected().path.str()
if !isdirectory(path)
let path = fnamemodify(path, ':p:h')
endif
let old_wd = getcwd()
if old_wd == path
call s:VCOP.systemlist(['xclip-pastefile'])
else
noautocmd exe 'cd' fnameescape(path)
call s:VCOP.systemlist(['xclip-pastefile'])
noautocmd exe 'cd' fnameescape(old_wd)
endif
endfunction
function! s:copy_to_system_clipboard() abort
let filename = g:NERDTreeFileNode.GetSelected().path.str()
call s:VCOP.systemlist(['xclip-copyfile', filename])
echo 'Yanked:' . (type(filename) == 3 ? len(filename) : 1 ) . ( isdirectory(filename) ? 'directory' : 'file' )
endfunction

View File

@ -1,4 +1,7 @@
scriptencoding utf-8 scriptencoding utf-8
let s:VCOP = SpaceVim#api#import('vim#compatible')
let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1) let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1)
let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1) let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1)
let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1) let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1)
@ -15,7 +18,8 @@ let g:vimfiler_ignore_pattern = get(g:, 'vimfiler_ignore_pattern', [
\ '^\.DS_Store$', \ '^\.DS_Store$',
\ '^\.init\.vim-rplugin\~$', \ '^\.init\.vim-rplugin\~$',
\ '^\.netrwhist$', \ '^\.netrwhist$',
\ '\.class$' \ '\.class$',
\ '^\.'
\]) \])
if has('mac') if has('mac')
@ -80,6 +84,8 @@ function! s:vimfilerinit()
nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit') nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit')
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split') nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch') nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
nnoremap <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR>
nnoremap <silent><buffer> P :<C-u>call <SID>paste_to_file_manager()<CR>
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated) nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line) nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
nmap <buffer> v <Plug>(vimfiler_quick_look) nmap <buffer> v <Plug>(vimfiler_quick_look)
@ -92,4 +98,37 @@ function! s:vimfilerinit()
nmap <buffer> <Right> <Plug>(vimfiler_smart_l) nmap <buffer> <Right> <Plug>(vimfiler_smart_l)
endf endf
function! s:paste_to_file_manager() abort
let path = vimfiler#get_filename()
if !isdirectory(path)
let path = fnamemodify(path, ':p:h')
endif
let old_wd = getcwd()
if old_wd == path
call s:VCOP.systemlist(['xclip-pastefile'])
else
noautocmd exe 'cd' fnameescape(path)
call s:VCOP.systemlist(['xclip-pastefile'])
noautocmd exe 'cd' fnameescape(old_wd)
endif
endfunction
function! s:copy_to_system_clipboard() abort
let filename = vimfiler#get_marked_filenames(b:vimfiler)
if empty(filename)
" Use cursor filename.
let filename = vimfiler#get_filename()
if filename ==# '..' || empty(vimfiler#get_file(b:vimfiler))
let filename = b:vimfiler.current_dir
else
let filename = vimfiler#get_file(b:vimfiler).action__path
endif
call s:VCOP.systemlist(['xclip-copyfile', filename])
else
call s:VCOP.systemlist(['xclip-copyfile'] + filename)
endif
echo 'Yanked:' . (type(filename) == 3 ? len(filename) : 1 ) . ' files'
endfunction
" vim:set et sw=2: " vim:set et sw=2:

View File

@ -1,22 +1,39 @@
"let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' "let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
"let g:ycm_confirm_extra_conf = 0 "let g:ycm_confirm_extra_conf = 0
let g:ycm_collect_identifiers_from_tags_files = 1 let g:ycm_collect_identifiers_from_tags_files =
let g:ycm_collect_identifiers_from_comments_and_strings = 1 \ get(g:, 'ycm_collect_identifiers_from_tags_files', 1)
let g:ycm_key_list_select_completion = ['<C-TAB>', '<Down>'] let g:ycm_collect_identifiers_from_comments_and_strings =
let g:ycm_key_list_previous_completion = ['<C-S-TAB>','<Up>'] \ get(g:, 'ycm_collect_identifiers_from_comments_and_strings', 1)
let g:ycm_seed_identifiers_with_syntax = 1 let g:ycm_key_list_select_completion =
let g:ycm_key_invoke_completion = '<leader><tab>' \ get(g:, 'ycm_key_list_select_completion', ['<C-TAB>', '<Down>'])
let g:ycm_semantic_triggers = { let g:ycm_key_list_previous_completion =
\ 'c' : ['->', '.'], \ get(g:, 'ycm_key_list_previous_completion', ['<C-S-TAB>','<Up>'])
\ 'objc' : ['->', '.'], let g:ycm_seed_identifiers_with_syntax =
\ 'ocaml' : ['.', '#'], \ get(g:, 'ycm_seed_identifiers_with_syntax', 1)
\ 'cpp,objcpp' : ['->', '.', '::'], let g:ycm_key_invoke_completion =
\ 'perl' : ['->'], \ get(g:, 'ycm_key_invoke_completion', '<leader><tab>')
\ 'php' : ['->', '::'],
\ 'cs,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], let g:ycm_semantic_triggers = get(g:, 'ycm_semantic_triggers', {})
\ 'java,jsp' : ['.'],
\ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], function! s:set_ft_triggers(ft, expr, override) abort
\ 'ruby' : ['.', '::'], if a:override
\ 'lua' : ['.', ':'], let g:ycm_semantic_triggers[a:ft] = a:expr
\ 'erlang' : [':'], elseif !has_key(g:ycm_semantic_triggers, a:ft)
\ } let g:ycm_semantic_triggers[a:ft] = a:expr
endif
endfunction
call s:set_ft_triggers('c', ['->', '.'], 0)
call s:set_ft_triggers('objc', ['->', '.'], 0)
call s:set_ft_triggers('ocaml', ['.', '#'], 0)
call s:set_ft_triggers('cpp,objcpp', ['->', '.', '::'], 0)
call s:set_ft_triggers('perl', ['->'], 0)
call s:set_ft_triggers('php', ['->', '::'], 0)
call s:set_ft_triggers('cs,javascript,d,python,perl6,scala,vb,elixir,go', ['.'], 0)
call s:set_ft_triggers('java,jsp', ['.'], 0)
call s:set_ft_triggers('vim', ['re![_a-zA-Z]+[_\w]*\.'], 0)
call s:set_ft_triggers('ruby', ['.', '::'], 0)
call s:set_ft_triggers('lua', ['.', ':'], 0)
call s:set_ft_triggers('erlang', [':'], 0)
call s:set_ft_triggers('sh', ['re![\w-]{2}', '/', '-'], 0)
call s:set_ft_triggers('zsh', ['re![\w-]{2}', '/', '-'], 0)

View File

@ -1,6 +1,6 @@
" If you want :UltiSnipsEdit to split your window. " If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical" let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsExpandTrigger='<tab>' let g:UltiSnipsExpandTrigger='<Nop>'
let g:UltiSnipsJumpBackwardTrigger="<c-z>" let g:UltiSnipsJumpBackwardTrigger='<Nop>'
let g:UltiSnipsJumpForwardTrigger='<tab>' let g:UltiSnipsJumpForwardTrigger='<Nop>'
let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips' let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips'

View File

@ -282,9 +282,9 @@ Set the information symbol for SpaceVim's syntax maker. Default is '🛈'.
*g:spacevim_terminal_cursor_shape* *g:spacevim_terminal_cursor_shape*
Set the SpaceVim cursor shape in the terminal. Set to 0 to prevent Nvim from Set the SpaceVim cursor shape in the terminal. Set to 0 to prevent Nvim from
changing the cursor shape. Set to 1 to enable non-blinking mode-sensitive changing the cursor shape. Set to 1 to enable non-blinking mode-sensitive
cursor (this is the default). Set to 2 to enable blinking mode-sensitive cursor. Set to 2 to enable blinking mode-sensitive cursor (this is the
cursor. Host terminal must support the DECSCUSR CSI escape sequence. default). Host terminal must support the DECSCUSR CSI escape sequence.
Depending on the terminal emulator, using this option with nvim under tmux Depending on the terminal emulator, using this option with nvim under tmux
might require adding the following to ~/.tmux.conf: might require adding the following to ~/.tmux.conf:

View File

@ -15,6 +15,10 @@ plugins:
github: [metadata] github: [metadata]
sass:
sass_dir: _sass
style: compressed
author: author:
name: Shidong Wang name: Shidong Wang
twitter: SpaceVim twitter: SpaceVim

View File

@ -1,122 +1,115 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script> <script>
(adsbygoogle = window.adsbygoogle || []).push({ (adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-5073224535135889", google_ad_client: "ca-pub-5073224535135889",
enable_page_level_ads: true enable_page_level_ads: true
});
</script>
{% seo %}
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c6bde3c13e6fd8fde7357f71b4dd53a7";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=60680063" charset="UTF-8"></script>
<!-- Google Tag Manager -->
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
}); });
var f = d.getElementsByTagName(s)[0], </script>
j = d.createElement(s), <meta name="baidu-site-verification" content="TUNbZyzuOn" />
dl = l != 'dataLayer' ? '&l=' + l : ''; {% seo %}
j.async = true; <script type="text/javascript" src="http://tajs.qq.com/stats?sId=60680063" charset="UTF-8"></script>
j.src = <script>
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; (function(w, d, s, l, i) {
f.parentNode.insertBefore(j, f); w[l] = w[l] || [];
})(window, document, 'script', 'dataLayer', 'GTM-PCLWNCD'); w[l].push({
</script> 'gtm.start': new Date().getTime(),
<!-- End Google Tag Manager --> event: 'gtm.js'
<meta charset="utf-8"> });
<meta http-equiv="X-UA-Compatible" content="chrome=1"> </script>
<title>{{ page.title | default: Home }} - SpaceVim</title> <script>
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> var _hmt = _hmt || [];
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> (function() {
<script src="{{ '/assets/js/respond.js' | relative_url }}"></script> var hm = document.createElement("script");
<!--[if lt IE 9]> hm.src = "https://hm.baidu.com/hm.js?c6bde3c13e6fd8fde7357f71b4dd53a7";
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> var s = document.getElementsByTagName("script")[0];
<![endif]--> s.parentNode.insertBefore(hm, s);
<!--[if lt IE 8]> })();
<link rel="stylesheet" href="{{ '/assets/css/ie.css' | relative_url }}"> </script>
<![endif]--> <!-- Google Tag Manager -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
<script> new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
(function() { j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
var bp = document.createElement('script'); 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
var curProtocol = window.location.protocol.split(':')[0]; })(window,document,'script','dataLayer','GTM-PCLWNCD');
if (curProtocol === 'https') { </script>
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; <!-- End Google Tag Manager -->
} else { <meta charset="utf-8">
bp.src = 'http://push.zhanzhang.baidu.com/push.js'; <meta http-equiv="X-UA-Compatible" content="chrome=1">
} <title>{{ page.title | default: Home }} - SpaceVim</title>
var s = document.getElementsByTagName("script")[0]; <link rel="stylesheet" href="{{ '/assets/css/main.css?v=' | append: site.github.build_revision | relative_url }}">
s.parentNode.insertBefore(bp, s); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
})(); <script src="{{ '/assets/js/respond.js' | relative_url }}"></script>
</script> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head> <script>
(function() {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
</head>
<body> <body>
<!-- Google Tag Manager (noscript) --> <!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PCLWNCD" <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PCLWNCD"
height="0" width="0" style="display:none;visibility:hidden"></iframe> height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript> </noscript>
<!-- End Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) -->
<a href="https://github.com/SpaceVim/SpaceVim"> <a href="https://github.com/SpaceVim/SpaceVim">
<img alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" style="position: absolute; top: 0; right: 0; border: 0;"/> <img alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" style="position: absolute; top: 0; right: 0; border: 0;"/>
</a> </a>
<div class="wrapper"> <div class="wrapper">
<section> <section>
<div id="title"> <div id="title">
<h1>{{ site.title | default: site.github.repository_name }}</h1> <h1>{{ site.title | default: site.github.repository_name }}</h1>
<p>{{ site.description | default: site.github.project_tagline }}</p> <p>{{ site.description | default: site.github.project_tagline }}</p>
<hr> <hr>
<p align="center"> <p align="center">
<b><a href="{{ site.url }}">Home</a></b> | <b><a href="{{ site.url }}">Home</a></b> |
<b><a href="{{ site.url }}/about">About</a></b> | <b><a href="{{ site.url }}/about">About</a></b> |
<b><a href="{{ site.url }}/documentation">Documentation</a></b> | <b><a href="{{ site.url }}/documentation">Documentation</a></b> |
<b><a href="{{ site.url }}/development">Development</a></b> | <b><a href="{{ site.url }}/development">Development</a></b> |
<b><a href="{{ site.url }}/community">Community</a></b> | <b><a href="{{ site.url }}/community">Community</a></b> |
<b><a href="{{ site.url }}/sponsors">Sponsors</a></b> <b><a href="{{ site.url }}/sponsors">Sponsors</a></b>
</p> </p>
<hr> <hr>
</div> </div>
{{ content }} {{ content }}
</section> </section>
</div> </div>
{% if site.google_analytics %} {% if site.google_analytics %}
<script type="text/javascript"> <script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
try { try {
var pageTracker = _gat._getTracker("{{ site.google_analytics }}"); var pageTracker = _gat._getTracker("{{ site.google_analytics }}");
pageTracker._trackPageview(); pageTracker._trackPageview();
} catch (err) {} } catch (err) {}
</script> </script>
{% endif %} {% endif %}
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-58a01d3aac22bd89"></script> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-58a01d3aac22bd89"></script>
</body> </body>
<root> <root>
<p align="center"> <p align="center">
<span class="credits right">Hosted on GitHub &mdash; Theme by <a href="https://twitter.com/michigangraham">mattgraham</a></span> <span class="credits right">Hosted on GitHub &mdash; Theme by <a href="https://twitter.com/michigangraham">mattgraham</a></span>
</p> </p>
</root> </root>
</html> </html>

View File

@ -0,0 +1,15 @@
---
title: "An async code runner in SpaceVim"
categories: tutorials
excerpt: "A better way for running code with in vim, more info about the command status, will not move cursor from code buffer."
---
# [Blogs](https://spacevim.org/community#blogs) > An async code runner in SpaceVim
when edit code, sometimes I want run current file. as we know vim's build-in feature `:!`, but it is not running asynchronously.
here is an gif shown how we can run code within SpaceVim. the first line is showing the command, the last line is showing the exit code and the time that has been consumed. the default key binding is `SPC l r`, `SPC` means `<Space>` on your keyboard.
![async code runner](https://user-images.githubusercontent.com/13142418/33722240-141ed716-db2f-11e7-9a4d-c99f05cc1d05.gif)
as wrote in old blog, we can also use this feature for java, c, php, JavaScript, etc.

View File

@ -1,3 +1,8 @@
@charset "utf-8";
// Variables
@import "variables";
/*! normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */ /*! normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */
/* ============================================================================= HTML5 display definitions ========================================================================== */ /* ============================================================================= HTML5 display definitions ========================================================================== */
/* Corrects block display not defined in IE6/7/8/9 & FF3 */ /* Corrects block display not defined in IE6/7/8/9 & FF3 */
@ -214,13 +219,17 @@ p, ul, ol, table, pre, dl { margin: 0 0 20px; }
h1, h2, h3 { line-height: 1.1; } h1, h2, h3 { line-height: 1.1; }
h1 { font-size: 28px; } h1 { font-size: $h1-font-size; }
h2 { font-size: 24px; } h2 { font-size: $h2-font-size; }
h4, h5, h6 { color: #e8e8e8; } h4, h5, h6 { color: #e8e8e8; }
h3 { font-size: 18px; line-height: 24px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; color: #b6b6b6; } h3 { font-size: $h3-font-size; line-height: 24px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; color: #b6b6b6; }
h4 { font-size: $h4-font-size; }
h5 { font-size: $h5-font-size; }
h6 { font-size: $h6-font-size; }
a { color: #ffcc00; font-weight: 400; text-decoration: none; } a { color: #ffcc00; font-weight: 400; text-decoration: none; }
a:hover { color: #ffeb9b; } a:hover { color: #ffeb9b; }

View File

@ -0,0 +1,7 @@
$h1-font-size: 2em;
$h2-font-size: 1.8em;
$h3-font-size: 1.6em;
$h4-font-size: 1.4em;
$h5-font-size: 1.2em;
$h6-font-size: 1em;

View File

@ -1,23 +1,27 @@
--- ---
title: "About" title: "About"
description: "Introduction about SpaceVim organization." description: "SpaceVim is a communicate driven vim distribution that supports vim and neovim"
--- ---
# About SpaceVim ## Version
[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a Modular configuration, a bundle of custom settings and plugins for Vim, [SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution that supports vim and Neovim. SpaceVim manages collections of plugins in layers. Layers make it easy for you, the user, to enable a new language or feature by grouping all the related plugins together. It got inspired by spacemacs.
here we call them layers, each layer has different plugins and config, users just need
to select the layers they need. It got inspired by [spacemacs](https://github.com/syl20bnr/spacemacs). If you use SpaceVim,
please star it on github. It's a great way of getting feedback and gives me the kick to
put more time into development.
If you encounter any bugs or have feature requests, just open an issue ## Goals
report on Github.
For learning about Vim in general, read [vim-galore](https://github.com/mhinz/vim-galore). - Provide a consistent user experience across platforms.
- Provide better default layer for defferent languages.
# Credits & Thanks ## Principles
- Do not regress from origin
- Decide outcomes by weighing cost and benefit
- prefer usability over tradition if the benefits are overwhelming
- Give usability a chance™
## Credits & Thanks
- Current maintainer: [Wang Shidong](https://github.com/wsdjeg)
- [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) - [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors)
- [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim - [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim
- [Rafael Bodill](https://github.com/rafi) and his vim-config - [Rafael Bodill](https://github.com/rafi) and his vim-config

View File

@ -0,0 +1,6 @@
---
# this ensures Jekyll reads the file to be transformed into CSS later
# only Main files contain this front matter, not partials.
---
@import "_spacevim.scss";

View File

@ -1,23 +1,32 @@
--- ---
title: "Community" title: "Community"
description: "A list for community channels for SpaceVim."
--- ---
# Community # Community
Try these SpaceVim hangouts for any questions, problems or comments. Visit these resources for help or general questions.
## Ask ## Ask
- [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) for issue and feature requests - [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) for issue and feature requests
- vi StackExchange for "how to" & configuration questions - Try [vi.stackexchange.com](https://vi.stackexchange.com/) for **usage and configuration questions**.
- [Twitter](https://twitter.com/SpaceVim) for hugs & pithy comments - [Twitter](https://twitter.com/SpaceVim) for hugs & pithy comments
- [Facebook](https://www.facebook.com/SpaceVim)
## Chat ## Chat
- [![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) (bridged to #spacevim IRC)
All of these channels are bridged together. Click on one of the badges below to join the chat, In all of these channels, messages from `SpaceVimBot` is sent by remote user, and the format of the remote messages is:
"[{PROTOCOL}] <{NICK}> {MESSAGE}"
- [`SpaceVim/SpaceVim` on gitter](https://gitter.im/SpaceVim/SpaceVim)
- [`#spacevim` on FreeNode](https://webchat.freenode.net/?channels=spacevim) - [`#spacevim` on FreeNode](https://webchat.freenode.net/?channels=spacevim)
- [![QQ](https://img.shields.io/badge/QQ群-121056965-blue.svg)](https://jq.qq.com/?_wv=1027&k=43DB6SG) - [`t.me/SpaceVim` on telegram](t.me/SpaceVim)
- [![Facebook](https://img.shields.io/badge/FaceBook-SpaceVim-blue.svg)](https://www.facebook.com/SpaceVim) - [`#spacevim:matrix.org` on Matrix](https://riot.im/app/#/room/%23spacevim:matrix.org)
- [/r/spacevim on Reddit](https://reddit.com/r/spacevim) - [`#spacevim` on slack](https://spacevim.slack.com/messages/C88CTJ62J)
## Discuss ## Discuss
- [google mailing list](https://groups.google.com/forum/#!forum/spacevim) - [google mailing list](https://groups.google.com/forum/#!forum/spacevim)
- [/r/spacevim on Reddit](https://reddit.com/r/spacevim)

View File

@ -1,23 +1,37 @@
--- ---
title: "Development" title: "Development"
description: "A guide for contributing to SpaceVim." description: "Development information about SpaceVim, including contributing guidelines and changelog."
--- ---
# Development # Development
<!-- vim-markdown-toc GFM -->
- [Contribution guidelines](#contribution-guidelines)
- [Asking for help](#asking-for-help)
- [Reporting issues](#reporting-issues)
- [Contributing code](#contributing-code)
- [License](#license)
- [Conventions](#conventions)
- [Pull Request](#pull-request)
- [Ideally for simple PRs (most of them):](#ideally-for-simple-prs-most-of-them)
- [For complex PRs (big refactoring, etc):](#for-complex-prs-big-refactoring-etc)
- [Contributing a layer](#contributing-a-layer)
- [File header](#file-header)
- [Author of a new layer](#author-of-a-new-layer)
- [Contributor to an existing layer](#contributor-to-an-existing-layer)
- [Contributing a keybinding](#contributing-a-keybinding)
- [Contributing a banner](#contributing-a-banner)
- [Contributing a statusline theme](#contributing-a-statusline-theme)
- [Build with SpaceVim](#build-with-spacevim)
- [Changelog](#changelog)
<!-- vim-markdown-toc -->
Development happens in the GitHub repository. here is a throughput graph of the repository for the last few weeks: Development happens in the GitHub repository. here is a throughput graph of the repository for the last few weeks:
[![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) [![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput)
## Content
- [Contribution guidelines](#contribution-guidelines)
- [Asking for help](#asking-for-help)
- [Reporting issues](#reporting-issues)
- [Contributing code](#contributing-code)
- [Build with SpaceVim](#build-with-spacevim)
- [Changelog](#changelog)
## Contribution guidelines ## Contribution guidelines
SpaceVim is an effort of all the volunteers, we encourage you to pitch in. The community makes SpaceVim what it is. SpaceVim is an effort of all the volunteers, we encourage you to pitch in. The community makes SpaceVim what it is.
@ -32,12 +46,14 @@ You can only consider reading the sections relevant to what you are going to do:
### Asking for help ### Asking for help
If you want to ask an usage question, be sure to look first into some places as it may hold the answers: If you want to ask an usage question, be sure to look first into some places as it may hold the answers:
- <kbd>:h SpaceVim-faq</kbd>: Some of the most frequently asked questions are answered there. - <kbd>:h SpaceVim-faq</kbd>: Some of the most frequently asked questions are answered there.
- [SpaceVim documentation](https://spacevim.org/documentation): It is the general documentation of SpaceVim. - [SpaceVim documentation](https://spacevim.org/documentation): It is the general documentation of SpaceVim.
### Reporting issues ### Reporting issues
Issues have to be reported on [issues tracker](https://github.com/SpaceVim/SpaceVim/issues), Please: Issues have to be reported on [issues tracker](https://github.com/SpaceVim/SpaceVim/issues), Please:
- Check that there is no duplicate issue in the issues tracker, you can search for keywords in the issues tracker. - Check that there is no duplicate issue in the issues tracker, you can search for keywords in the issues tracker.
- Check that the issue has not been fixed in latest version of SpaceVim, please update your SpaceVim, and try to reproduce the bug here. - Check that the issue has not been fixed in latest version of SpaceVim, please update your SpaceVim, and try to reproduce the bug here.
- Use a clear title and follow the issue template. - Use a clear title and follow the issue template.
@ -50,6 +66,7 @@ Code contributions are welcome. Please read the following sections carefully. In
#### License #### License
The license is MIT for all the parts of SpaceVim. this includes: The license is MIT for all the parts of SpaceVim. this includes:
- The initialization and core files - The initialization and core files
- All the layer files. - All the layer files.
@ -94,29 +111,27 @@ Write commit messages according to adapted [Tim Popes guidelines](http://tbag
This is a model commit message: This is a model commit message:
``` Capitalized, short (72 chars or less) summary
Capitalized, short (72 chars or less) summary
More detailed explanatory text, if necessary. Wrap it to about 72 More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the the body entirely); tools like rebase can get confused if you run the
two together. two together.
Write your commit message in the imperative: "Fix bug" and not "Fixed bug" Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug." This convention matches up with commit messages generated or "Fixes bug." This convention matches up with commit messages generated
by commands like git merge and git revert. by commands like git merge and git revert.
Further paragraphs come after blank lines. Further paragraphs come after blank lines.
- Bullet points are okay, too - Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, followed by a - Typically a hyphen or asterisk is used for the bullet, followed by a
single space, with blank lines in between, but conventions vary here single space, with blank lines in between, but conventions vary here
- Use a hanging indent - Use a hanging indent
```
[Gita] provide vim mode for Git commit messages, which helps you to comply to these guidelines. [Gita] provide vim mode for Git commit messages, which helps you to comply to these guidelines.
@ -222,6 +237,7 @@ If you have some ASCII skills you can submit your artwork!
You are free to choose a reasonable height size but the width size should be around 75 characters. You are free to choose a reasonable height size but the width size should be around 75 characters.
#### Contributing a statusline theme
## Build with SpaceVim ## Build with SpaceVim

View File

@ -1,16 +1,42 @@
--- ---
title: "Conventions" title: "Conventions"
description: "conventions of contribute to SpaceVim, including the coding style guide about vim script and markdown" description: "conventions of contributing to SpaceVim, including the coding style guides about vim script and markdown"
permalink: "/conventions" permalink: "/conventions"
--- ---
# Conventions # Conventions
## Content <!-- vim-markdown-toc GFM -->
- [commit emoji convention](#commit-emoji-convention) - [Commit emoji convention](#commit-emoji-convention)
- [viml coding style guild](#viml-coding-style-guide) - [Viml coding style guide](#viml-coding-style-guide)
- [markdown style guide](#markdown-style-guide) - [Portability](#portability)
- [Strings](#strings)
- [Matching Strings](#matching-strings)
- [Regular Expressions](#regular-expressions)
- [Dangerous commands](#dangerous-commands)
- [Fragile commands](#fragile-commands)
- [Catching Exceptions](#catching-exceptions)
- [General Guidelines](#general-guidelines)
- [Messaging](#messaging)
- [Type checking](#type-checking)
- [Python](#python)
- [Other Languages](#other-languages)
- [Plugin layout](#plugin-layout)
- [Functions](#functions)
- [Commands](#commands)
- [Autocommands](#autocommands)
- [Mappings](#mappings)
- [Errors](#errors)
- [Settings](#settings)
- [Style](#style)
- [Whitespace](#whitespace)
- [Line Continuations](#line-continuations)
- [Naming](#naming)
- [Markdown style guide](#markdown-style-guide)
- [Thanks:](#thanks)
<!-- vim-markdown-toc -->
## Commit emoji convention ## Commit emoji convention
@ -23,29 +49,35 @@ permalink: "/conventions"
- :beer: I'm happy like reduced code complexity. - :beer: I'm happy like reduced code complexity.
## Viml coding style guide ## Viml coding style guide
### Portability ### 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: 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 #### Strings
**Prefer single quoted strings** **Prefer single quoted strings**
Double quoted strings are semantically different in vimscript, and you probably don't want them (they break regexes). 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. 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 #### Matching Strings
**Use the =~# or =~? operator families over the =~ family.** **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. 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 #### 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. **Prefix 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. 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 #### Dangerous commands
**Avoid commands with unintended side effects.** **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. Avoid using :s[ubstitute] as it moves the cursor and prints error messages. Prefer functions (such as search()) better suited to scripts.
@ -55,6 +87,7 @@ The meaning of the g flag depends upon the gdefault setting. If you do use :subs
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. 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 #### Fragile commands
**Avoid commands that rely on user settings.** **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. Always use normal! instead of normal. The latter depends upon the user's key mappings and could do anything.
@ -64,12 +97,15 @@ Avoid :s[ubstitute], as its behavior depends upon a number of local settings.
The same applies to other commands not listed here. The same applies to other commands not listed here.
#### Catching Exceptions #### Catching Exceptions
**Match error codes, not error text.** **Match error codes, not error text.**
Error text may be locale dependant. Error text may be locale dependant.
### General Guidelines ### General Guidelines
#### Messaging #### Messaging
**Message the user infrequently.** **Message the user infrequently.**
Loud scripts are annoying. Message the user only when: Loud scripts are annoying. Message the user only when:
@ -78,6 +114,7 @@ Loud scripts are annoying. Message the user only when:
- An error has occurred. - An error has occurred.
#### Type checking #### Type checking
**Use strict and explicit checks where possible.** **Use strict and explicit checks where possible.**
Vimscript has unsafe, unintuitive behavior when dealing with some types. For instance, 0 == 'foo' evaluates to true. Vimscript has unsafe, unintuitive behavior when dealing with some types. For instance, 0 == 'foo' evaluates to true.
@ -89,21 +126,25 @@ Check variable types explicitly before using them. Use functions from maktaba#en
Use :unlet for variables that may change types, particularly those assigned inside loops. Use :unlet for variables that may change types, particularly those assigned inside loops.
#### Python #### Python
**Use sparingly.** **Use sparingly.**
Use python only when it provides critical functionality, for example when writing threaded code. Use python only when it provides critical functionality, for example when writing threaded code.
#### Other Languages #### Other Languages
**Use vimscript instead.** **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. 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 #### Plugin layout
**Organize functionality into modular plugins** **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). 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 #### Functions
**In the autoload/ directory, defined with [!] and [abort].** **In the autoload/ directory, defined with [!] and [abort].**
Autoloading allows functions to be loaded on demand, which makes startuptime faster and enforces function namespacing. Autoloading allows functions to be loaded on demand, which makes startuptime faster and enforces function namespacing.
@ -117,6 +158,7 @@ Non-library plugins should expose commands instead of functions. Command logic s
[abort] forces the function to halt when it encounters an error. [abort] forces the function to halt when it encounters an error.
#### Commands #### Commands
**In the plugin/commands.vim or under the ftplugin/ directory, defined without [!].** **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/. General commands go in plugin/commands.vim. Filetype-specific commands go in ftplugin/.
@ -124,6 +166,7 @@ General commands go in plugin/commands.vim. Filetype-specific commands go in ftp
Excluding [!] prevents your plugin from silently clobbering existing commands. Command conflicts should be resolved by the user. Excluding [!] prevents your plugin from silently clobbering existing commands. Command conflicts should be resolved by the user.
#### Autocommands #### Autocommands
**Place them in plugin/autocmds.vim, within augroups.** **Place them in plugin/autocmds.vim, within augroups.**
Place all autocommands in augroups. Place all autocommands in augroups.
@ -133,6 +176,7 @@ The augroup name should be unique. It should either be, or be prefixed with, the
Clear the augroup with autocmd! before defining new autocommands in the augroup. This makes your plugin re-entrable. Clear the augroup with autocmd! before defining new autocommands in the augroup. This makes your plugin re-entrable.
#### Mappings #### Mappings
**Place them in plugin/mappings.vim, using maktaba#plugin#MapPrefix to get a prefix.** **Place them in plugin/mappings.vim, using maktaba#plugin#MapPrefix to get a prefix.**
All key mappings should be defined in plugin/mappings.vim. All key mappings should be defined in plugin/mappings.vim.
@ -148,6 +192,7 @@ Your plugins generally shouldn't introduce mappings, but if they do, the map com
When using catch, match the error code rather than the error text. When using catch, match the error code rather than the error text.
#### Settings #### Settings
**Change settings locally** **Change settings locally**
Use :setlocal and &l: instead of :set and & unless you have explicit reason to do otherwise. Use :setlocal and &l: instead of :set and & unless you have explicit reason to do otherwise.
@ -189,6 +234,7 @@ such as "noremap <leader>gf :grep -f ".
``` ```
#### Line Continuations #### Line Continuations
- Prefer line continuations on semantic boundaries. - Prefer line continuations on semantic boundaries.
```diff ```diff
@ -214,6 +260,7 @@ autocommand BufEnter <buffer>
- Do not continue multi-line commands when you can avoid it. Prefer function calls. - Do not continue multi-line commands when you can avoid it. Prefer function calls.
#### Naming #### Naming
In general, use plugin-names-like-this, FunctionNamesLikeThis, CommandNamesLikeThis, augroup_names_like_this, variable_names_like_this. In general, use plugin-names-like-this, FunctionNamesLikeThis, CommandNamesLikeThis, augroup_names_like_this, variable_names_like_this.
Always prefix variables with their scope. Always prefix variables with their scope.
@ -221,28 +268,29 @@ Always prefix variables with their scope.
- plugin-names-like-this - plugin-names-like-this
Keep them short and sweet. Keep them short and sweet.
- FunctionNamesLikeThis - FunctionNamesLikeThis
- Prefix script-local functions with s: - Prefix script-local functions with s:
- Autoloaded functions may not have a scope prefix. - Autoloaded functions may not have a scope prefix.
- Do not create global functions. Use autoloaded functions instead. - Do not create global functions. Use autoloaded functions instead.
- CommandNamesLikeThis - CommandNamesLikeThis
Prefer succinct command names over common command prefixes. Prefer succinct command names over common command prefixes.
- variable_names_like_this - variable_names_like_this
Augroup names count as variables for naming purposes. Augroup names count as variables for naming purposes.
- Prefix all variables with their scope. - Prefix all variables with their scope.
- Global variables with g: - Global variables with g:
- Script-local variables with s: - Script-local variables with s:
- Function arguments with a: - Function arguments with a:
- Function-local variables with l: - Function-local variables with l:
- Vim-predefined variables with v: - Vim-predefined variables with v:
- Buffer-local variables with b: - Buffer-local variables with b:
- g:, s:, and a: must always be used. - g:, s:, and a: must always be used.
- b: changes the variable semantics; use it when you want buffer-local semantics. - 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. - 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.
## Markdown style guide ## Markdown style guide
## Thanks: ## Thanks:
- link : https://google.github.io/styleguide/vimscriptguide.xml
- link : https://google.github.io/styleguide/vimscriptfull.xml - link : <https://google.github.io/styleguide/vimscriptguide.xml>
- link : https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt - link : <https://google.github.io/styleguide/vimscriptfull.xml>
- link : <https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt>
- [google's markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) - [google's markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md)

View File

@ -88,6 +88,7 @@ description: "General documentation about how to using SpaceVim, including the q
- [Auto-indent pasted text](#auto-indent-pasted-text) - [Auto-indent pasted text](#auto-indent-pasted-text)
- [Text manipulation commands](#text-manipulation-commands) - [Text manipulation commands](#text-manipulation-commands)
- [Text insertion commands](#text-insertion-commands) - [Text insertion commands](#text-insertion-commands)
- [Increase/Decrease numbers](#increasedecrease-numbers)
- [Commenting](#commenting) - [Commenting](#commenting)
- [Multi-Encodings](#multi-encodings) - [Multi-Encodings](#multi-encodings)
- [Errors handling](#errors-handling) - [Errors handling](#errors-handling)
@ -514,6 +515,40 @@ The letters displayed in the statusline correspond to the key bindings used to t
| `SPC t S` | Ⓢ | S | enabled in spell checking | | `SPC t S` | Ⓢ | S | enabled in spell checking |
| `SPC t w` | ⓦ | w | whitespace mode | | `SPC t w` | ⓦ | w | whitespace mode |
**colorscheme of statusline:**
current version only support `gruvbox`/`molokai`/`nord`/`one`/`onedark`, if you want to contribute theme please check the template of a statusline theme.
```vim
" 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],
" \ ]
" group_a: window id
" group_b/group_c: stausline sections
" group_z: empty area
" group_i: window id in insert mode
" group_v: window id in visual mode
" group_r: window id in select mode
function! SpaceVim#mapping#guide#theme#gruvbox#palette() abort
return [
\ ['#282828', '#a89984', 246, 235],
\ ['#a89984', '#504945', 239, 246],
\ ['#a89984', '#3c3836', 237, 246],
\ ['#665c54', 241],
\ ['#282828', '#83a598', 235, 109],
\ ['#282828', '#fe8019', 235, 208],
\ ['#282828', '#8ec07c', 235, 108],
\ ]
endfunction
```
#### tabline #### tabline
Buffers will be listed on tabline if there is only one tab, each item contains the index, filetype icon and the bufname. if there are more than one tab, all tabs will be listed on the tabline. each item can be quickly accessed using `<Leader> number`. default `<Leader>` is `\`. Buffers will be listed on tabline if there is only one tab, each item contains the index, filetype icon and the bufname. if there are more than one tab, all tabs will be listed on the tabline. each item can be quickly accessed using `<Leader> number`. default `<Leader>` is `\`.
@ -530,6 +565,15 @@ Buffers will be listed on tabline if there is only one tab, each item contains t
| `<Leader> 8` | jump to index 8 on tabline | | `<Leader> 8` | jump to index 8 on tabline |
| `<Leader> 9` | jump to index 9 on tabline | | `<Leader> 9` | jump to index 9 on tabline |
SpaceVim tabline also support mouse click, left mouse button will switch to buffer, middle button will delete the buffer.
**NOTE:** this feature is only supported in neovim with `has('tablineat')`.
| Key Binding | Description |
| ---------------- | ------------------ |
| `<Mouse-left>` | jump to the buffer |
| `<Mouse-middle>` | delete the buffer |
## Manual ## Manual
### Completion ### Completion
@ -881,27 +925,31 @@ VCS integration is supported, there will be a column status, this feature maybe
Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm):
| Key Binding | Description | | Key Binding | Description |
| ----------------------------- | ------------------------------------------------- | | ------------------------------ | ------------------------------------------------- |
| `<F3>` or `SPC f t` | Toggle file explorer | | `<F3>` or `SPC f t` | Toggle file explorer |
| **Within _VimFiler_ buffers** | | | **Within _file tree_ buffers** | |
| `<Left>` or `h` | go to parent node and collapse expanded directory | | `<Left>` or `h` | go to parent node and collapse expanded directory |
| `<Down>` or `j` | select next file or directory | | `<Down>` or `j` | select next file or directory |
| `<Up>` or `k` | select previous file or directory | | `<Up>` or `k` | select previous file or directory |
| `<Right>` or `l` | open selected file or expand directory | | `<Right>` or `l` | open selected file or expand directory |
| `Ctrl`+`j` | Un-map | | `Ctrl`+`j` | Un-map |
| `Ctrl`+`l` | Un-map | | `Ctrl`+`l` | Un-map |
| `E` | Un-map | | `E` | Un-map |
| `.` | toggle visible ignored files | | `N` | Create new file under corsor |
| `sv` | Split edit | | `yy` | Copy file full path to system clipboard |
| `sg` | Vertical split edit | | `yY` | Copy file to system clipboard |
| `p` | Preview | | `P` | Paste file to the position under the cursor |
| `i` | Switch to directory history | | `.` | toggle visible ignored files |
| `v` | Quick look | | `sv` | Split edit |
| `gx` | Execute with vimfiler associated | | `sg` | Vertical split edit |
| `'` | Toggle mark current line | | `p` | Preview |
| `V` | Clear all marks | | `i` | Switch to directory history |
| `Ctrl`+`r` | Redraw | | `v` | Quick look |
| `gx` | Execute with vimfiler associated |
| `'` | Toggle mark current line |
| `V` | Clear all marks |
| `Ctrl`+`r` | Redraw |
##### Open file with file tree. ##### Open file with file tree.
@ -1173,18 +1221,18 @@ Background search keyword in a project, when searching done, the count will be s
key binding in FlyGrep buffer: key binding in FlyGrep buffer:
Key Binding Description | Key Binding | Description |
\-----------\| ----------- | ---------------- | --------------------------------- |
`<Esc>` | close FlyGrep buffer | `<Esc>` | close FlyGrep buffer |
`<Enter>` | open file at the cursor line | `<Enter>` | open file at the cursor line |
`<Tab>` | move cursor line down | `<Tab>` | move cursor line down |
`<S-Tab>` | move cursor line up | `<S-Tab>` | move cursor line up |
`<Bs>` | remove last character | `<Bs>` | remove last character |
`<C-w>` | remove the Word before the cursor | `<C-w>` | remove the Word before the cursor |
`<C-u>` | remove the Line before the cursor | `<C-u>` | remove the Line before the cursor |
`<C-k>` | remove the Line after the cursor | `<C-k>` | remove the Line after the cursor |
`<C-a>`/`<Home>` | Go to the beginning of the line | `<C-a>`/`<Home>` | Go to the beginning of the line |
`<C-e>`/`<End>` | Go to the end of the line | `<C-e>`/`<End>` | Go to the end of the line |
#### Persistent highlighting #### Persistent highlighting
@ -1275,6 +1323,23 @@ Text insertion commands (start with `i`):
| `SPC i U 4` | insert UUIDv4 (use universal argument to insert with CID format) | | `SPC i U 4` | insert UUIDv4 (use universal argument to insert with CID format) |
| `SPC i U U` | insert UUIDv4 (use universal argument to insert with CID format) | | `SPC i U U` | insert UUIDv4 (use universal argument to insert with CID format) |
#### Increase/Decrease numbers
| Key Binding | Description |
| ----------- | ------------------------------------------------------------------- |
| `SPC n +` | increase the number under point by one and initiate transient state |
| `SPC n -` | decrease the number under point by one and initiate transient state |
In transient state:
| Key Binding | Description |
| ------------- | -------------------------------------- |
| `+` | increase the number under point by one |
| `-` | decrease the number under point by one |
| Any other key | leave the transient state |
**Tips:** you can increase or decrease a value by more that once by using a prefix argument (i.e. `10 SPC n +` will add 10 to the number under point).
#### Commenting #### Commenting
Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), its bound to the following keys. Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), its bound to the following keys.
@ -1335,7 +1400,7 @@ Custom sign symbol:
| ------ | ----------- | --------------------------- | | ------ | ----------- | --------------------------- |
| `✖` | Error | `g:spacevim_error_symbol` | | `✖` | Error | `g:spacevim_error_symbol` |
| `➤` | warning | `g:spacevim_warning_symbol` | | `➤` | warning | `g:spacevim_warning_symbol` |
| `🛈` | Info | `g:spacevim_info_symbol` | | `🛈` | Info | `g:spacevim_info_symbol` |
### Managing projects ### Managing projects
@ -1347,7 +1412,6 @@ project manager commands start with `p`:
| ----------- | ----------------------------------------------------- | | ----------- | ----------------------------------------------------- |
| `SPC p '` | open a shell in projects root (with the shell layer) | | `SPC p '` | open a shell in projects root (with the shell layer) |
## EditorConfig ## EditorConfig
SpaceVim has support for [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” SpaceVim has support for [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.”
@ -1362,32 +1426,31 @@ SpaceVim starts a server at launch. This server is killed whenever you close you
If you are using neovim, you need to install [neovim-remote](https://github.com/mhinz/neovim-remote), then add this to your bashrc. If you are using neovim, you need to install [neovim-remote](https://github.com/mhinz/neovim-remote), then add this to your bashrc.
``` export PATH=$PATH:$HOME/.SpaceVim/bin
export PATH=$PATH:$HOME/.SpaceVim/bin
```
Use `svc` to open a file in the existing Vim server, or using `nsvc` to open a file in the existing neovim server. Use `svc` to open a file in the existing Vim server, or using `nsvc` to open a file in the existing neovim server.
![server-and-client](https://user-images.githubusercontent.com/13142418/32554968-7164fe9c-c4d6-11e7-95f7-f6a6ea75e05b.gif) ![server-and-client](https://user-images.githubusercontent.com/13142418/32554968-7164fe9c-c4d6-11e7-95f7-f6a6ea75e05b.gif)
<!-- SpaceVim Achievements start --> <!-- SpaceVim Achievements start -->
## Achievements ## Achievements
### issues ### issues
Achievements | Account | Achievements | Account |
----- | ----- | --------------------------------------------------------------------- | ------------------------------------------- |
[100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) | [100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) |
### Stars, forks and watchers ### Stars, forks and watchers
Achievements | Account | Achievements | Account |
----- | ----- | ----------------- | ------------------------------------------------- |
First stargazers | [monkeydterry](https://github.com/monkeydterry) | First stargazers | [monkeydterry](https://github.com/monkeydterry) |
100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) | 100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) |
1000th stargazers | [elvin-du](https://github.com/elvin-du) | 1000th stargazers | [elvin-du](https://github.com/elvin-du) |
2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) | 2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) |
3000th stargazers | [WellerQu](https://github.com/WellerQu) | 3000th stargazers | [WellerQu](https://github.com/WellerQu) |
<!-- SpaceVim Achievements end --> <!-- SpaceVim Achievements end -->

View File

@ -14,7 +14,7 @@ SpaceVim is a community-driven vim distribution that supports vim and Neovim. S
Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either! Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either!
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) ![welcome-page](https://user-images.githubusercontent.com/13142418/33793078-3446cb6e-dc76-11e7-9998-376a355557a4.png)
See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information.

View File

@ -1,5 +1,6 @@
--- ---
title: "SpaceVim autocomplete layer" title: "SpaceVim autocomplete layer"
description: "This layer provides auto-completion to SpaceVim"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) autocomplete # [SpaceVim Layers:](https://spacevim.org/layers) autocomplete

View File

@ -1,5 +1,6 @@
--- ---
title: "SpaceVim checkers layer" title: "SpaceVim checkers layer"
description: "This layer provides syntax checking feature"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) checkers # [SpaceVim Layers:](https://spacevim.org/layers) checkers

View File

@ -1,8 +1,14 @@
# [Layers](https://spacevim.org/layers) > colorscheme ---
title: "SpaceVim colorscheme layer"
description: "colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme."
---
# [SpaceVim Layers:](https://spacevim.org/layers) colorscheme
This layer provides many Vim colorschemes for SpaceVim, the default colorscheme is gruvbox. This layer provides many Vim colorschemes for SpaceVim, the default colorscheme is gruvbox.
To change the colorscheme: To change the colorscheme:
```vim ```vim
let g:spacevim_colorscheme = 'onedark' let g:spacevim_colorscheme = 'onedark'
``` ```

View File

@ -1,5 +1,6 @@
--- ---
title: "SpaceVim git layer" title: "SpaceVim git layer"
description: "This layers adds extensive support for git"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) git # [SpaceVim Layers:](https://spacevim.org/layers) git

60
docs/layers/lang/c.md Normal file
View File

@ -0,0 +1,60 @@
---
title: "SpaceVim lang#c layer"
description: "This layer is for c/c++/object-c development"
---
# [Layers](https://spacevim.org/layers) > lang#c
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Layer Installation](#layer-installation)
- [Configuration](#configuration)
<!-- vim-markdown-toc -->
## Description
This layer is for c/c++/object-c development.
## Layer Installation
To use this configuration layer, add `SPLayer 'lang#c'` to your custom configuration file or load layer with custom options.
```vim
call SpaceVim#layers#load('lang#c',
\ {
\ 'enable_libclang' : 1,
\ }
\ )
```
## Configuration
- `clang_executable` (string)
set the path to the clang executable
- `enable_libclang` (boolean)
use libclang instead of `clang -cc1`, by default it is 0.
- `libclang_path` (string)
The libclang shared object (dynamic library) file path. by default it is empty.
- `clang_std` (dict)
```json
{
"c": "c11",
"cpp": "c++1z",
"objc": "c11",
"objcpp": "c++1z",
}
```
- `clang_flag`
Create a `.clang` file at your project root. You should be able to just paste most of your compile flags in there. You can also use a list ['-Iwhatever', ...] when loadding this layer.

View File

@ -1,18 +1,20 @@
--- ---
title: "SpaceVim lang#java layer" title: "SpaceVim lang#java layer"
description: "This layer is for Java development"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#java # [SpaceVim Layers:](https://spacevim.org/layers) lang#java
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
* [Description](#description)
* [Layer Installation](#layer-installation) - [Description](#description)
* [Key bindings](#key-bindings) - [Layer Installation](#layer-installation)
* [Java language specified key bindings](#java-language-specified-key-bindings) - [Key bindings](#key-bindings)
* [Maven](#maven) - [Java language specified key bindings](#java-language-specified-key-bindings)
* [Jump](#jump) - [Maven](#maven)
* [Problems buffer](#problems-buffer) - [Jump](#jump)
* [Project buffer](#project-buffer) - [Problems buffer](#problems-buffer)
- [Project buffer](#project-buffer)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->

View File

@ -7,10 +7,10 @@ description: "This layer is for JaveScript development"
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [Description](#description) * [Description](#description)
- [Layer Installation](#layer-installation) * [Layer Installation](#layer-installation)
- [Features](#features) * [Features](#features)
- [Layer configuration](#layer-configuration) * [Layer configuration](#layer-configuration)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->
@ -31,6 +31,7 @@ To use this configuration layer, add `call SpaceVim#layers#load('lang#javascript
## Layer configuration ## Layer configuration
`use_lsp`: Use language server if possible. The default value is `0`.
`auto_fix`: auto fix problems when save files, disabled by default. if you need this feature, you can load this layer via: `auto_fix`: auto fix problems when save files, disabled by default. if you need this feature, you can load this layer via:
```vim ```vim

View File

@ -1,16 +1,17 @@
--- ---
title: "SpaceVim lang#markdown layer" title: "SpaceVim lang#markdown layer"
description: "Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file."
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#markdown # [SpaceVim Layers:](https://spacevim.org/layers) lang#markdown
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
* [Description](#description) - [Description](#description)
* [Layer Installation](#layer-installation) - [Layer Installation](#layer-installation)
* [formatting](#formatting) - [formatting](#formatting)
* [options](#options) - [options](#options)
* [Key bindings](#key-bindings) - [Key bindings](#key-bindings)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->

View File

@ -1,13 +1,15 @@
--- ---
title: "SpaceVim lang#php layer" title: "SpaceVim lang#php layer"
description: "This layer adds PHP language support to SpaceVim"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#php # [SpaceVim Layers:](https://spacevim.org/layers) lang#php
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
* [Description](#description)
* [Layer Installation](#layer-installation) - [Description](#description)
* [Requirement](#requirement) - [Layer Installation](#layer-installation)
- [Requirement](#requirement)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->

View File

@ -1,12 +1,14 @@
--- ---
title: "SpaceVim lang#python layer" title: "SpaceVim lang#python layer"
description: "This layer is for Python development, provide autocompletion, syntax checking, code format for python file."
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#python # [SpaceVim Layers:](https://spacevim.org/layers) lang#python
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
* [Description](#description)
* [Features](#features) - [Description](#description)
- [Features](#features)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->

View File

@ -1,5 +1,6 @@
--- ---
title: "SpaceVim lang#typescript layer" title: "SpaceVim lang#typescript layer"
description: "This layer is for TypeScript development"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#typescript # [SpaceVim Layers:](https://spacevim.org/layers) lang#typescript

View File

@ -1,16 +1,18 @@
--- ---
title: "SpaceVim shell layer" title: "SpaceVim shell layer"
description: "This layer provide shell support in SpaceVim"
--- ---
# [SpaceVim Layers:](https://spacevim.org/layers) shell # [SpaceVim Layers:](https://spacevim.org/layers) shell
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
* [Description](#description)
* [Install](#install) - [Description](#description)
* [Configuration](#configuration) - [Install](#install)
* [Default shell](#default-shell) - [Configuration](#configuration)
* [Default shell position and height](#default-shell-position-and-height) - [Default shell](#default-shell)
* [Key bindings](#key-bindings) - [Default shell position and height](#default-shell-position-and-height)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->

View File

@ -1,5 +1,6 @@
--- ---
title: "Sponsors" title: "Sponsors"
description: "the companies or individuals contributing a monthly amount to help sustain SpaceVim's development."
--- ---
![Bountysource](https://spacevim.org/img/bountysource.png) ![Bountysource](https://spacevim.org/img/bountysource.png)
@ -10,18 +11,18 @@ Also, you can buy me a coffee:
<a href='https://ko-fi.com/A538L6H' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> <a href='https://ko-fi.com/A538L6H' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
if you are a chinese, It will be more easy in wechat. | wechat | alipay |
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| <img src="https://spacevim.org/img/weixin.png" height="150" width="150"> | <img src="https://spacevim.org/img/zhifubao.png" height="150" width="150"> |
![Buy me a coffee](https://spacevim.org/img/buy_me_a_coffee.png) Bitcoin: 1DtuVeg81c2L9NEhDaVTAAbrCR3pN5xPFv
# Current Sponsors # Current Sponsors
These are the companies or individuals contributing a monthly amount to help sustain SpaceVim's development. These are the companies or individuals contributing a monthly amount to help sustain SpaceVim's development.
See the [Bountysource campaign](https://www.bountysource.com/teams/spacevim) for more details. See the [Bountysource campaign](https://www.bountysource.com/teams/spacevim) for more details.
Date | Description | Date | Description |
-------------- | ---------------------- | --------- | --------------------------------------------- |
2017-2-23 | user from wechat contributed ¥40 to SpaceVim | 2017-2-23 | user from wechat contributed ¥40 to SpaceVim |
2017-2-14 | user from wechat contributed ¥100 to SpaceVim | 2017-2-14 | user from wechat contributed ¥100 to SpaceVim |

View File

@ -1,8 +1,8 @@
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
endif endif
let b:current_syntax = "SpaceVimFlyGrep" let b:current_syntax = "SpaceVimFlyGrep"
syntax case ignore syntax case ignore
syn match FileName /[^:]*:\d\+:/
hi def link FileName Comment hi def link FileName Comment
call matchadd('FileName', '[^:]*:\d\+:', 2)

20
syntax/SpaceVimRunner.vim Normal file
View File

@ -0,0 +1,20 @@
if exists("b:current_syntax")
finish
endif
let b:current_syntax = "SpaceVimRunner"
syntax case ignore
syn match KeyBindings /\[Running\]/
syn match KeyBindings /\[Compile\]/
syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/
syn match RunnerCmd /\(\[Compile\]\ \)\@<=.*/
syn match DoneSucceeded /\[Done]\(\ exited\ with\ code=0\)\@=/
syn match DoneFailed /\[Done]\(\ exited\ with\ code=[^0]\)\@=/
syn match ExitCode /\(\[Done\]\ exited\ with \)\@<=code=0/
syn match ExitCodeFailed /\(\[Done\]\ exited\ with \)\@<=code=[^0]/
hi def link RunnerCmd Comment
hi def link KeyBindings String
hi def link DoneSucceeded String
hi def link DoneFailed WarningMsg
hi def link ExitCode MoreMsg
hi def link ExitCodeFailed WarningMsg

View File

@ -11,3 +11,4 @@ Execute ( SpaceVim api: data#list ):
AssertEqual list.char_range('a', 'c'), ['a', 'b', 'c'] AssertEqual list.char_range('a', 'c'), ['a', 'b', 'c']
AssertEqual list.has(['a', 'c'], 'a'), 1 AssertEqual list.has(['a', 'c'], 'a'), 1
AssertEqual list.has_index(['a', 'c'], 1), 1 AssertEqual list.has_index(['a', 'c'], 1), 1
AssertEqual list.replace([1, 2, 3, 4, 5, 6, 7], 3, 5, [0, 0, 0, 0]), [1, 2, 3, 0, 0, 0, 0, 7]