neoformat
neoformat copied to clipboard
Neoformat ignoring enabled setting
Neoformat seems to ignore my enabled formatters on occasion and decides to run prettier
instead. I am wondering what I can do to prevent that since it ruins my flow every time it happens. This mostly affectterraform
and ocaml
files. My config is below.
augroup fmt
autocmd!
autocmd BufWritePre * undojoin | Neoformat
augroup END
autocmd FileType javascript set formatprg=prettier\ --stdin\ --parser\ flow\ --single-quote\ --print-width\ 100\ --no-semi\ --trailing-comma\ es5
autocmd FileType javascript.jsx set formatprg=prettier\ --stdin\ --parser\ flow\ --single-quote\ --print-width\ 101\ --no-semi\ --trailing-comma\ es5
autocmd FileType javascript JsPreTmpl html
autocmd FileType graphql set formatprg=prettier
autocmd FileType json set formatprg=prettier
autocmd FileType yaml set formatprg=pyaml
autocmd FileType toml set formatprg=
autocmd FileType markdown set formatprg=prettier\ --parser\ markdown
let g:neoformat_try_formatprg = 1
let g:neoformat_enabled_javascript = [ 'prettier' ]
let g:neoformat_enabled_terraform = [ 'terraform' ]
let g:neoformat_enabled_handlebars = []
let g:neoformat_enabled_reason = [ 'refmt' ]
let g:neoformat_enabled_ocaml = ['ocamlformat']
let g:neoformat_enabled_html = []
Here is the relevant section from the logs when I save an OCaml
file. Shouldn't Neoformat
only run ocamlformat
since I have let g:neoformat_enabled_ocaml = ['ocamlformat']
configured?
Neoformat: prettier --parser markdown
Neoformat: using stdin
set ft?
returns filetype=ocaml
I am pretty sure that a formatprg
will override any other setup for that filetype.
Not sure why the markdown formatprg
is being used for other filetypes.
If you remove the let g:neoformat_try_formatprg = 1
what happens?
I can't reproduce when I remove let g:neoformat_try_formatprg