X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/yaml/yq.vim?ds=sidebyside diff --git a/.vim/bundle/ale/ale_linters/yaml/yq.vim b/.vim/bundle/ale/ale_linters/yaml/yq.vim new file mode 100644 index 00000000..35aef654 --- /dev/null +++ b/.vim/bundle/ale/ale_linters/yaml/yq.vim @@ -0,0 +1,22 @@ +" Author: axhav +call ale#Set('yaml_yq_executable', 'yq') +call ale#Set('yaml_yq_options', '') +call ale#Set('yaml_yq_filters', '.') + +" Matches patterns like the following: +let s:pattern = '^Error\:.* line \(\d\+\)\: \(.\+\)$' + +function! ale_linters#yaml#yq#Handle(buffer, lines) abort + return ale#util#MapMatches(a:lines, s:pattern, {match -> { + \ 'lnum': match[1] + 0, + \ 'text': match[2], + \}}) +endfunction + +call ale#linter#Define('yaml', { +\ 'name': 'yq', +\ 'executable': {b -> ale#Var(b, 'yaml_yq_executable')}, +\ 'output_stream': 'stderr', +\ 'command': '%e', +\ 'callback': 'ale_linters#yaml#yq#Handle', +\})