1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 12:30:40 +08:00

Improve checker layer

This commit is contained in:
wsdjeg 2018-01-03 21:15:12 +08:00
parent 66fba051d5
commit 7d873e99ae
2 changed files with 31 additions and 12 deletions

View File

@ -5,6 +5,7 @@
let s:SIG = SpaceVim#api#import('vim#signatures')
let s:STRING = SpaceVim#api#import('data#string')
function! SpaceVim#layers#checkers#plugins() abort
let plugins = []
@ -19,6 +20,14 @@ function! SpaceVim#layers#checkers#plugins() abort
return plugins
endfunction
let s:last_echoed_error = has('timers')
function! SpaceVim#layers#checkers#set_variable(var) abort
let s:show_cursor_error = get(a:var, 'show_cursor_error', 1)
endfunction
function! SpaceVim#layers#checkers#config() abort
let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300)
@ -46,19 +55,20 @@ function! SpaceVim#layers#checkers#config() abort
if g:spacevim_enable_neomake
autocmd User NeomakeFinished nested
\ let &l:statusline = SpaceVim#layers#core#statusline#get(1)
if s:last_echoed_error
" when move cursor, the error message will be shown below current line
" after a delay
autocmd CursorMoved * call <SID>neomake_cursor_move_delay()
" when move cursor, the error message will be shown below current line
" after a delay
autocmd CursorMoved * call <SID>neomake_cursor_move_delay()
" when switch to Insert mode, stop timer and clear the signature
if exists('##CmdLineEnter')
autocmd InsertEnter,WinLeave,CmdLineEnter *
\ call <SID>neomake_signatures_clear()
autocmd CmdLineEnter *
\ call <SID>neomake_signatures_clear() | redraw
else
autocmd InsertEnter,WinLeave * call <SID>neomake_signatures_clear()
" when switch to Insert mode, stop timer and clear the signature
if exists('##CmdLineEnter')
autocmd InsertEnter,WinLeave,CmdLineEnter *
\ call <SID>neomake_signatures_clear()
autocmd CmdLineEnter *
\ call <SID>neomake_signatures_clear() | redraw
else
autocmd InsertEnter,WinLeave * call <SID>neomake_signatures_clear()
endif
endif
elseif g:spacevim_enable_ale
autocmd User ALELint

View File

@ -24,6 +24,15 @@ checkers layer is loaded by default.
## Configuration
By default, the error will be display below current line, if you want to disabled this feature, you may need to load this layer with `show_cursor_error` to 0.
```vim
call SpaceVim#layers#load('checkers', {
\ 'show_cursor_error' : 0,
\ })
```
| Name | default value | description |
| ---------------------------- | ------------- | -------------------------------------------------------- |
| `g:spacevim_enable_neomake` | 1 | Use neomake as default checking tools |