summaryrefslogtreecommitdiff
path: root/plugin/ale.vim
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2016-10-11 16:51:01 -0500
committerBjorn Neergaard <bjorn@neersighted.com>2016-10-13 08:51:38 -0500
commitdc58db764064ec924b78c43acff32607845edac5 (patch)
treea851dded57a5bb1255c18beba9c480efdd396153 /plugin/ale.vim
parentf4159ac7eeb3787574692a451bff9159b039d395 (diff)
downloadale-dc58db764064ec924b78c43acff32607845edac5.zip
Implement a more efficient statusbar
The statusbar now keeps its state in a separate variable, in order to avoid excess iterations. The engine now updates said variable on run, and a new function is made available for external statusbars to call (to avoid dependencies on internal implementation details of ale). To keep things light, the status bar code is not loaded unless invoked by the user or an external plugin. On the first load it will update itself from the global loclist, after that, the engine will handle all updates. The external integration function, `ale#statusline#Count()`, will return a tuple in the format [E, W] (where E is errors, W is warnings), unless no data exists (ie, the plugin doesn't have a linter for a file or has not run yet), in which case it returns 0/false.
Diffstat (limited to 'plugin/ale.vim')
-rw-r--r--plugin/ale.vim8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim
index 9b45cd7c..d1c29902 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -24,6 +24,7 @@ endif
" Globals
+let g:ale_buffer_count_map = {}
let g:ale_buffer_loclist_map = {}
let g:ale_buffer_should_reset_map = {}
let g:ale_buffer_sign_dummy_map = {}
@@ -98,7 +99,8 @@ let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
" This flag can be set to 0 to disable echoing when the cursor moves.
-if get(g:, 'ale_echo_cursor', 1)
+let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
+if g:ale_echo_cursor
augroup ALECursorGroup
autocmd!
autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay()
@@ -120,10 +122,10 @@ let g:ale_warn_about_trailing_whitespace =
" Housekeeping
-augroup ALECleanup
+augroup ALECleanupGroup
autocmd!
" Clean up buffers automatically when they are unloaded.
- autocmd BufUnload * call ale#cleanup#Buffer('<abuf>')
+ autocmd BufUnload * call ale#cleanup#Buffer(expand('<abuf>'))
augroup END
" Backwards Compatibility