File: gawk.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (23 lines) | stat: -rw-r--r-- 832 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
" Author: kmarc <korondi.mark@gmail.com>
" 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'
\})