mirror of
https://github.com/dense-analysis/ale.git
synced 2026-10-09 06:45:53 +08:00
#371 Allow buffer variables to be set based on patterns
This commit is contained in:
1 parent
7fe1119cf1
commit
c77cf0e518
4 files changed
+100
No files matched your search
@@ -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