Make the getcmdwintype() check ever-so-slightly faster

This commit is contained in:
w0rp 2017-10-14 17:31:58 +01:00
parent d8ea83e344
commit 40e69794eb

View File

@ -38,6 +38,8 @@ function! ale#FileTooLarge() abort
return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0 return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0
endfunction endfunction
let s:getcmdwintype_exists = exists('*getcmdwintype')
" A function for checking various conditions whereby ALE just shouldn't " A function for checking various conditions whereby ALE just shouldn't
" attempt to do anything, say if particular buffer types are open in Vim. " attempt to do anything, say if particular buffer types are open in Vim.
function! ale#ShouldDoNothing(buffer) abort function! ale#ShouldDoNothing(buffer) abort
@ -50,7 +52,7 @@ function! ale#ShouldDoNothing(buffer) abort
endif endif
" Do nothing if running from command mode " Do nothing if running from command mode
if exists('*getcmdwintype') && !empty(getcmdwintype()) if s:getcmdwintype_exists && !empty(getcmdwintype())
return 1 return 1
endif endif