summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/yamlfmt.vim
diff options
context:
space:
mode:
authorMatheus Werny <46067952+Spixmaster@users.noreply.github.com>2023-08-15 11:15:06 +0200
committerGitHub <noreply@github.com>2023-08-15 10:15:06 +0100
commit951b280bd5665eadd00e22bef7c7ef23cdc57854 (patch)
tree7a719e2464e34bcd5ef6ac87465852f0818c7fef /autoload/ale/fixers/yamlfmt.vim
parent15cbc0e912acf31d8185dbef00473e9555591350 (diff)
downloadale-951b280bd5665eadd00e22bef7c7ef23cdc57854.zip
yamlfmt (#4587)
* Added the fixer, wrote tests and tested it
Diffstat (limited to 'autoload/ale/fixers/yamlfmt.vim')
-rw-r--r--autoload/ale/fixers/yamlfmt.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fixers/yamlfmt.vim b/autoload/ale/fixers/yamlfmt.vim
new file mode 100644
index 00000000..e730832a
--- /dev/null
+++ b/autoload/ale/fixers/yamlfmt.vim
@@ -0,0 +1,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