mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-17 07:24:13 +08:00
Add nixfmt as a Nix fixer. (#3651)
* Add nixfmt fixer. * Replace manual options pad with ale#Pad()
This commit is contained in:
@@ -406,6 +406,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['ada'],
|
||||
\ 'description': 'Format Ada files with gnatpp.',
|
||||
\ },
|
||||
\ 'nixfmt': {
|
||||
\ 'function': 'ale#fixers#nixfmt#Fix',
|
||||
\ 'suggested_filetypes': ['nix'],
|
||||
\ 'description': 'A nix formatter written in Haskell.',
|
||||
\ },
|
||||
\ 'nixpkgs-fmt': {
|
||||
\ 'function': 'ale#fixers#nixpkgsfmt#Fix',
|
||||
\ 'suggested_filetypes': ['nix'],
|
||||
|
||||
15
autoload/ale/fixers/nixfmt.vim
Normal file
15
autoload/ale/fixers/nixfmt.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
scriptencoding utf-8
|
||||
" Author: houstdav000 <houstdav000@gh0st.sh>
|
||||
" Description: Fix files with nixfmt
|
||||
|
||||
call ale#Set('nix_nixfmt_executable', 'nixfmt')
|
||||
call ale#Set('nix_nixfmt_options', '')
|
||||
|
||||
function! ale#fixers#nixfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'nix_nixfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'nix_nixfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ale#Pad(l:options),
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user