summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/yamlfmt.vim
blob: e730832a03754c776bb165332d025c551199ee75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
" Author: https://github.com/Spixmaster
" Description: Format YAML files with yamlfmt.

call ale#Set('yaml_yamlfmt_executable', 'yamlfmt')
call ale#Set('yaml_yamlfmt_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('yaml_yamlfmt_options', '')

function! ale#fixers#yamlfmt#Fix(buffer) abort
    let l:executable = ale#python#FindExecutable(
    \   a:buffer,
    \   'yaml_yamlfmt',
    \   ['yamlfmt']
    \)

    let l:options = ale#Var(a:buffer, 'yaml_yamlfmt_options')

    return {
    \   'command': ale#Escape(l:executable) . ' ' . l:options . ' -in',
    \}
endfunction