diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-04 23:54:14 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-04 23:54:14 +0100 |
commit | 13a8f9c06110c065086ce7e569bab68d0e222398 (patch) | |
tree | a20f312df929d82d81a96adc4061772602ae7b80 /autoload | |
parent | 9ddf1b6a050bea6706bd51f2fd5f252c735bc1cc (diff) | |
download | ale-13a8f9c06110c065086ce7e569bab68d0e222398.zip |
Optimise ale#Var a little
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale.vim | 11 | ||||
-rw-r--r-- | autoload/ale/fix.vim | 7 |
2 files changed, 4 insertions, 14 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index dcc12150..8aa8bbd9 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -191,15 +191,12 @@ endfunction " " Every variable name will be prefixed with 'ale_'. function! ale#Var(buffer, variable_name) abort - let l:nr = str2nr(a:buffer) let l:full_name = 'ale_' . a:variable_name + let l:vars = getbufvar(str2nr(a:buffer), '', 0) - if bufexists(l:nr) - let l:vars = getbufvar(l:nr, '') - elseif has_key(g:, 'ale_fix_buffer_data') - let l:vars = get(g:ale_fix_buffer_data, l:nr, {'vars': {}}).vars - else - let l:vars = {} + if l:vars is 0 + " Look for variables from deleted buffers, saved from :ALEFix + let l:vars = get(get(g:ale_fix_buffer_data, a:buffer, {}), 'vars', {}) endif return get(l:vars, l:full_name, g:[l:full_name]) diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim index 1e056200..6e5875f6 100644 --- a/autoload/ale/fix.vim +++ b/autoload/ale/fix.vim @@ -1,10 +1,3 @@ -" This global Dictionary tracks the ALE fix data for jobs, etc. -" This Dictionary should not be accessed outside of the plugin. It is only -" global so it can be modified in Vader tests. -if !has_key(g:, 'ale_fix_buffer_data') - let g:ale_fix_buffer_data = {} -endif - if !has_key(s:, 'job_info_map') let s:job_info_map = {} endif |