diff options
author | w0rp <w0rp@users.noreply.github.com> | 2019-10-07 19:22:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 19:22:01 +0100 |
commit | d3a3f4011bf514372584344e3860b8c9c39e01f1 (patch) | |
tree | c98279b70322d3d58ce9a329b18a7bfca40f97a9 /autoload | |
parent | cebbb67ea6e2555f4438d61333c96764a389cf6b (diff) | |
parent | 6aeb46217177924367fe1961a7e615f3e4052298 (diff) | |
download | ale-d3a3f4011bf514372584344e3860b8c9c39e01f1.zip |
Merge pull request #2676 from davidtwco/nixfmt-fixer
Add nixpkgs-fmt fixer.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/nixpkgsfmt.vim | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 750d2196..2a96a7d6 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -345,6 +345,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['ada'], \ 'description': 'Format Ada files with gnatpp.', \ }, +\ 'nixpkgs-fmt': { +\ 'function': 'ale#fixers#nixpkgsfmt#Fix', +\ 'suggested_filetypes': ['nix'], +\ 'description': 'A formatter for Nix code', +\ }, \} " Reset the function registry to the default entries. diff --git a/autoload/ale/fixers/nixpkgsfmt.vim b/autoload/ale/fixers/nixpkgsfmt.vim new file mode 100644 index 00000000..403ce798 --- /dev/null +++ b/autoload/ale/fixers/nixpkgsfmt.vim @@ -0,0 +1,12 @@ +call ale#Set('nix_nixpkgsfmt_executable', 'nixpkgs-fmt') +call ale#Set('nix_nixpkgsfmt_options', '') + +function! ale#fixers#nixpkgsfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nix_nixpkgsfmt_executable') + let l:options = ale#Var(a:buffer, 'nix_nixpkgsfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction |