X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/awk/gawk.vim diff --git a/.vim/bundle/ale/ale_linters/awk/gawk.vim b/.vim/bundle/ale/ale_linters/awk/gawk.vim new file mode 100644 index 00000000..0c3212fd --- /dev/null +++ b/.vim/bundle/ale/ale_linters/awk/gawk.vim @@ -0,0 +1,23 @@ +" Author: kmarc +" Description: This file adds support for using GNU awk with scripts. + +call ale#Set('awk_gawk_executable', 'gawk') +call ale#Set('awk_gawk_options', '') + +function! ale_linters#awk#gawk#GetCommand(buffer) abort + " note the --source 'BEGIN ...' is to prevent + " gawk from attempting to execute the body of the script + " it is linting. + return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') + \ . ' --lint' + \ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options')) + \ . ' -f %t /dev/null' +endfunction + +call ale#linter#Define('awk', { +\ 'name': 'gawk', +\ 'executable': {b -> ale#Var(b, 'awk_gawk_executable')}, +\ 'command': function('ale_linters#awk#gawk#GetCommand'), +\ 'callback': 'ale#handlers#gawk#HandleGawkFormat', +\ 'output_stream': 'both' +\})