From eed5c0a46ed8c12ba84a2b86a4baf2d82140bbb0 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 28 Nov 2017 20:40:10 +0800 Subject: [PATCH] Add signatures --- autoload/SpaceVim/layers/checkers.vim | 40 +++++++++++++++------------ config/plugins/neomake.vim | 2 ++ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index 61746dc0a..1d284634c 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -43,33 +43,39 @@ function! SpaceVim#layers#checkers#config() abort if g:spacevim_enable_ale autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1) endif - autocmd CursorHold * call signatures_current_error() - autocmd CursorMoved * call signatures_clear() + autocmd CursorMoved * call cursor_move_delay() augroup END - let g:neomake_echo_current_error = 0 +endfunction + +function! s:cursor_move_delay() abort + if exists('s:cursormoved_timer') + call timer_stop(s:cursormoved_timer) + endif + let s:cursormoved_timer = timer_start(get(g:, 'neomake_cursormoved_delay', 100), function('s:signatures_current_error')) endfunction let s:last_echoed_error = '' let s:clv = &conceallevel -function! s:signatures_current_error() abort - let message = neomake#GetCurrentErrorMsg() - if empty(message) - if exists('s:last_echoed_error') - echon '' - unlet s:last_echoed_error - endif - return - endif +function! s:signatures_current_error(...) abort + call s:signatures_clear() + let message = neomake#GetCurrentErrorMsg() + if empty(message) if exists('s:last_echoed_error') - \ && s:last_echoed_error == message - return + unlet s:last_echoed_error endif - let s:last_echoed_error = message - set conceallevel=2 - call s:SIG.info(line('.') + 1, col('.'), message) + return + endif + if exists('s:last_echoed_error') + \ && s:last_echoed_error == message + return + endif + let s:last_echoed_error = message + set conceallevel=2 + call s:SIG.info(line('.') + 1, col('.'), message) endfunction function! s:signatures_clear() abort + let s:last_echoed_error = '' let &conceallevel = s:clv call s:SIG.clear() endfunction diff --git a/config/plugins/neomake.vim b/config/plugins/neomake.vim index f7a229020..5a650714f 100644 --- a/config/plugins/neomake.vim +++ b/config/plugins/neomake.vim @@ -4,6 +4,8 @@ if get(g:, 'spacevim_lint_on_save', 0) let s:neomake_automake_events['BufWritePost'] = {'delay': 0} endif +let g:neomake_echo_current_error = 0 + if get(g:, 'spacevim_lint_on_the_fly', 0) let s:neomake_automake_events['TextChanged'] = {'delay': 750} let s:neomake_automake_events['TextChangedI'] = {'delay': 750}