summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-26 15:59:43 +0100
committerw0rp <devw0rp@gmail.com>2017-05-26 15:59:43 +0100
commitc77cf0e518e18b2e6f1f259c0f92e717d28c8998 (patch)
treee9a4c43ba79d0b0333c9c0d0f3f0177645388353 /autoload
parent7fe1119cf1154480d8035a078ff06d6739892551 (diff)
downloadale-c77cf0e518e18b2e6f1f259c0f92e717d28c8998.zip
#371 Allow buffer variables to be set based on patterns
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/pattern_options.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/autoload/ale/pattern_options.vim b/autoload/ale/pattern_options.vim
new file mode 100644
index 00000000..77d0b59f
--- /dev/null
+++ b/autoload/ale/pattern_options.vim
@@ -0,0 +1,18 @@
+" Author: w0rp <devw0rp@gmail.com>
+" Description: Set options in files based on regex patterns.
+
+function! ale#pattern_options#SetOptions() abort
+ let l:filename = expand('%:p')
+ let l:options = {}
+
+ for l:pattern in keys(g:ale_pattern_options)
+ if match(l:filename, l:pattern) >= 0
+ let l:options = g:ale_pattern_options[l:pattern]
+ break
+ endif
+ endfor
+
+ for l:key in keys(l:options)
+ let b:[l:key] = l:options[l:key]
+ endfor
+endfunction