mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 04:52:29 +08:00
#371 Allow buffer variables to be set based on patterns
This commit is contained in:
18
autoload/ale/pattern_options.vim
Normal file
18
autoload/ale/pattern_options.vim
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user