diff options
Diffstat (limited to 'plugin/ale.vim')
-rw-r--r-- | plugin/ale.vim | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim index d65a99cb..32aea550 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -4,11 +4,13 @@ " Sanity Checks -if exists('g:loaded_ale') +if exists('g:loaded_ale_dont_use_this_in_other_plugins_please') finish endif -let g:loaded_ale = 1 +" Set a special flag used only by this plugin for preventing doubly +" loading the script. +let g:loaded_ale_dont_use_this_in_other_plugins_please = 1 " A flag for detecting if the required features are set. if has('nvim') @@ -20,11 +22,19 @@ else endif if !s:has_features - echoerr 'ALE requires NeoVim >= 0.1.5 or Vim 8 with +timers +job +channel' - echoerr 'Please update your editor appropriately.' + " Only output a warning if editing some special files. + if index(['', 'gitcommit'], &filetype) == -1 + echoerr 'ALE requires NeoVim >= 0.1.5 or Vim 8 with +timers +job +channel' + echoerr 'Please update your editor appropriately.' + endif + + " Stop here, as it won't work. finish endif +" Set this flag so that other plugins can use it, like airline. +let g:loaded_ale = 1 + " Set the TMPDIR environment variable if it is not set automatically. " This can automatically fix some environments. if has('unix') && empty($TMPDIR) @@ -81,6 +91,9 @@ let g:ale_keep_list_window_open = get(g:, 'ale_keep_list_window_open', 0) " This is enabled by default only if the 'signs' feature exists. let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs')) +" This flag can be set to 0 to disable setting error highlights. +let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) + " These variables dicatate what sign is used to indicate errors and warnings. let g:ale_sign_error = get(g:, 'ale_sign_error', '>>') let g:ale_sign_warning = get(g:, 'ale_sign_warning', '--') @@ -118,6 +131,9 @@ let g:ale_statusline_format = get(g:, 'ale_statusline_format', let g:ale_warn_about_trailing_whitespace = \ get(g:, 'ale_warn_about_trailing_whitespace', 1) +" A flag for controlling the maximum size of the command history to store. +let g:ale_max_buffer_history_size = get(g:, 'ale_max_buffer_history_size', 20) + function! s:ALEInitAuGroups() abort augroup ALERunOnTextChangedGroup autocmd! @@ -146,6 +162,13 @@ function! s:ALEInitAuGroups() abort autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay() endif augroup END + + if !g:ale_enabled + augroup! ALERunOnTextChangedGroup + augroup! ALERunOnEnterGroup + augroup! ALERunOnSaveGroup + augroup! ALECursorGroup + endif endfunction function! s:ALEToggle() abort @@ -161,6 +184,11 @@ function! s:ALEToggle() abort " Clear signs, loclist, quicklist call ale#engine#SetResults(l:buffer, []) endfor + + " Remove highlights for the current buffer now. + if g:ale_set_highlights + call ale#highlight#UpdateHighlights() + endif endif call s:ALEInitAuGroups() @@ -177,7 +205,9 @@ command! ALENextWrap :call ale#loclist_jumping#Jump('after', 1) command! ALEToggle :call s:ALEToggle() " Define command to get information about current filetype. -command! ALEInfo :call ale#linter#Info() +command! ALEInfo :call ale#debugging#Info() +" The same, but copy output to your clipboard. +command! ALEInfoToClipboard :call ale#debugging#InfoToClipboard() " <Plug> mappings for commands nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return> |