From c903b776a38a69f20b922090043a068a909ab955 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 20:49:19 +0800 Subject: [PATCH] Update SPC e c command --- autoload/SpaceVim/layers/checkers.vim | 123 ++++++++++++++------------ doc/SpaceVim.txt | 10 ++- 2 files changed, 72 insertions(+), 61 deletions(-) diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index f43783ff2..e4e3161f8 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -4,82 +4,89 @@ " SpaceVim uses neomake as default syntax checker. function! SpaceVim#layers#checkers#plugins() abort - let plugins = [] + let plugins = [] - if g:spacevim_enable_neomake - call add(plugins, ['neomake/neomake', {'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1}]) - else - call add(plugins, ['wsdjeg/syntastic', {'on_event': 'WinEnter', 'loadconf' : 1, 'merged' : 0}]) - endif + if g:spacevim_enable_neomake + call add(plugins, ['neomake/neomake', {'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1}]) + else + call add(plugins, ['wsdjeg/syntastic', {'on_event': 'WinEnter', 'loadconf' : 1, 'merged' : 0}]) + endif - return plugins + return plugins endfunction function! SpaceVim#layers#checkers#config() abort - call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'sign unplace *', 'clear all errors', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'call call(' + \ . string(s:_function('s:clear_errors')) . ', [])', + \ 'clear all errors', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'h'], '', 'describe a syntax checker', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], '', 'verify syntax checker setup', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'n'], 'lnext', 'next-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'lopen', 'toggle showing the error list', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'lprevious', 'previous-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'N'], 'lNext', 'previous-error', 1) - call SpaceVim#mapping#space#def('nnoremap', ['e', '.'], 'call call(' - \ . string(s:_function('s:error_transient_state')) . ', [])', - \ 'error-transient-state', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', '.'], 'call call(' + \ . string(s:_function('s:error_transient_state')) . ', [])', + \ 'error-transient-state', 1) endfunction function! s:error_transient_state() abort - if empty(neomake#statusline#LoclistCounts()) - echo 'no buffers contain error message locations' - return - endif - let state = SpaceVim#api#import('transient_state') - call state.set_title('Error Transient State') - call state.defind_keys( - \ { - \ 'layout' : 'vertical split', - \ 'left' : [ - \ { - \ 'key' : 'n', - \ 'desc' : 'next error', - \ 'func' : '', - \ 'cmd' : 'try | lnext | catch | endtry', - \ 'exit' : 0, - \ }, - \ ], - \ 'right' : [ - \ { - \ 'key' : ['p', 'N'], - \ 'desc' : 'previous error', - \ 'func' : '', - \ 'cmd' : 'try | lprevious | catch | endtry', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : 'q', - \ 'desc' : 'quit', - \ 'func' : '', - \ 'cmd' : '', - \ 'exit' : 1, - \ }, - \ ], - \ } - \ ) - call state.open() + if empty(neomake#statusline#LoclistCounts()) + echo 'no buffers contain error message locations' + return + endif + let state = SpaceVim#api#import('transient_state') + call state.set_title('Error Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : 'n', + \ 'desc' : 'next error', + \ 'func' : '', + \ 'cmd' : 'try | lnext | catch | endtry', + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : ['p', 'N'], + \ 'desc' : 'previous error', + \ 'func' : '', + \ 'cmd' : 'try | lprevious | catch | endtry', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'q', + \ 'desc' : 'quit', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 1, + \ }, + \ ], + \ } + \ ) + call state.open() endfunction " function() wrapper if v:version > 703 || v:version == 703 && has('patch1170') - function! s:_function(fstr) abort - return function(a:fstr) - endfunction + function! s:_function(fstr) abort + return function(a:fstr) + endfunction else - function! s:_SID() abort - return matchstr(expand(''), '\zs\d\+\ze__SID$') - endfunction - let s:_s = '' . s:_SID() . '_' - function! s:_function(fstr) abort - return function(substitute(a:fstr, 's:', s:_s, 'g')) - endfunction + function! s:_SID() abort + return matchstr(expand(''), '\zs\d\+\ze__SID$') + endfunction + let s:_s = '' . s:_SID() . '_' + function! s:_function(fstr) abort + return function(substitute(a:fstr, 's:', s:_s, 'g')) + endfunction endif + + +function! s:clear_errors() abort + sign unplace * +endfunction diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 7a4161443..b16bc89ab 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -191,6 +191,13 @@ See more details in: http://spacevim.org/documentation/#statusline *g:spacevim_statusline_unicode_symbols* Enable/Disable unicode symbols in statusline + *g:spacevim_enable_statusline_display_mode* +Enable/Disable display mode. Default is 0, mode will be displayed in +statusline. To enable this feature: +> + let g:spacevim_enable_statusline_display_mode = 1 +< + *g:spacevim_enable_cursorcolumn* Enable/Disable cursorcolumn. Default is 0, cursorcolumn will be highlighted in normal mode. To enable this feature: @@ -313,9 +320,6 @@ Set SpaceVim windows index type, default is 0. *g:spacevim_enable_tabline_filetype_icon* Enable/Disable tabline filetype icon. default is 0. - *g:spacevim_enable_statusline_display_mode* -Enable/Disable statusline display mode. default is 0. - *g:spacevim_enable_os_fileformat_icon* Enable/Disable os fileformat icon. default is 0.