Support setting settings with g:ale_pattern_options
This commit is contained in:
parent
1b55e5edab
commit
ab47011ef2
2 changed files with 10 additions and 2 deletions
|
@ -13,6 +13,10 @@ function! ale#pattern_options#SetOptions() abort
|
|||
endfor
|
||||
|
||||
for l:key in keys(l:options)
|
||||
let b:[l:key] = l:options[l:key]
|
||||
if l:key[:0] ==# '&'
|
||||
call setbufvar(bufnr(''), l:key, l:options[l:key])
|
||||
else
|
||||
let b:[l:key] = l:options[l:key]
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
Before:
|
||||
Save g:ale_pattern_options, g:ale_pattern_options_enabled
|
||||
Save g:ale_pattern_options
|
||||
Save g:ale_pattern_options_enabled
|
||||
Save &filetype
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
@ -11,6 +13,7 @@ Execute(Buffer variables should be set when filename patterns match):
|
|||
let g:ale_pattern_options = {'baz.*\.js': {
|
||||
\ 'ale_enabled': 1,
|
||||
\ 'some_option': 347,
|
||||
\ '&filetype': 'pattern_option_set_filetype',
|
||||
\}}
|
||||
|
||||
silent! file foobar.js
|
||||
|
@ -26,3 +29,4 @@ Execute(Buffer variables should be set when filename patterns match):
|
|||
|
||||
AssertEqual 1, b:ale_enabled
|
||||
AssertEqual 347, b:some_option
|
||||
AssertEqual 'pattern_option_set_filetype', &filetype
|
||||
|
|
Reference in a new issue