From 983c7e880523de3b18e42f1405ba2d3ba6509960 Mon Sep 17 00:00:00 2001 From: cyy Date: Sun, 25 Aug 2019 22:14:53 +0800 Subject: [PATCH] add fish_indent fixer --- autoload/ale/fix/registry.vim | 5 +++++ autoload/ale/fixers/fish_indent.vim | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 autoload/ale/fixers/fish_indent.vim diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index d71668f2..ed3339c9 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -180,6 +180,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['cmake'], \ 'description': 'Fix CMake files with cmake-format.', \ }, +\ 'fish_indent': { +\ 'function': 'ale#fixers#fish_indent#Fix', +\ 'suggested_filetypes': ['fish'], +\ 'description': 'Fix fish shell scripts with fish_indent.', +\ }, \ 'gofmt': { \ 'function': 'ale#fixers#gofmt#Fix', \ 'suggested_filetypes': ['go'], diff --git a/autoload/ale/fixers/fish_indent.vim b/autoload/ale/fixers/fish_indent.vim new file mode 100644 index 00000000..215a14ec --- /dev/null +++ b/autoload/ale/fixers/fish_indent.vim @@ -0,0 +1,19 @@ +" Author: Chen YuanYuan +" Description: Integration of fish_indent with ALE. + +call ale#Set('fish_indent_executable', 'fish_indent') +call ale#Set('fish_indent_options', '') + +function! ale#fixers#fish_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'fish_indent_executable') + let l:options = ale#Var(a:buffer, 'fish_indent_options') + let l:filename = ale#Escape(bufname(a:buffer)) + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w ' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction