summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-16 00:16:48 +0100
committerw0rp <devw0rp@gmail.com>2017-04-16 00:16:48 +0100
commite80116cee03af66bb229c3f570f0b2f244f0a197 (patch)
treefbbce032e7d3db51b6dc50c71467d1e64f09a4b5 /autoload
parent7682fab2947ea13b2427bfdf2b42c30168712f92 (diff)
downloadale-e80116cee03af66bb229c3f570f0b2f244f0a197.zip
#427 Add a function for looking up ALE variables in buffer scope, and then global scope
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale.vim11
1 files changed, 11 insertions, 0 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 3c15f5d5..80ef3eed 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -96,3 +96,14 @@ endfunction
function! ale#ResetLintFileMarkers() abort
let s:should_lint_file_for_buffer = {}
endfunction
+
+" Given a buffer number and a variable name, look for that variable in the
+" buffer scope, then in global scope. If the name does not exist in the global
+" scope, an exception will be thrown.
+"
+" Every variable name will be prefixed with 'ale_'.
+function! ale#Var(buffer, variable_name) abort
+ let l:full_name = 'ale_' . a:variable_name
+
+ return getbufvar(a:buffer, l:full_name, g:[l:full_name])
+endfunction