sbdchd / neoformat

:sparkles: A (Neo)vim plugin for formatting code.
BSD 2-Clause "Simplified" License
1.98k stars 187 forks source link

Use perttier to format css file no work #98

Open zhaozhiming opened 7 years ago

zhaozhiming commented 7 years ago

Hi, I have updated my neoformat and prettier to the latest version, but it seems no work for formatting css files. Please help, thanks.

I use command :Neoformat prettier when editing css files, but it report Neoformat: formatters prettier failed to run. I use the same command and work in js file.

My vimrc file config as follow:

.vimrc

autocmd FileType javascript,css set formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5

.vimrc.bundle

Bundle 'sbdchd/neoformat'
" Use formatprg when available
let g:neoformat_try_formatprg = 1
sbdchd commented 7 years ago

Which version of prettier are you using?

zhaozhiming commented 7 years ago

@sbdchd 1.5.2

➜  ~ prettier -v
1.5.2
zhaozhiming commented 7 years ago

@sbdchd Hi, I have solved this problem. I change the neoformat config as follow and it's work.
You can close this issue.
Thanks.

" remove
" let g:neoformat_try_formatprg = 1
" add
let g:neoformat_run_all_formatters = 1
zhaozhiming commented 7 years ago

@sbdchd I think the document is not clear for the file format config.
I want to help, but I really don't know which is the correct and best config way for the file format.

zhaozhiming commented 7 years ago

@sbdchd I think this issue can't be closed yet.
I found when I add the let g:neoformat_run_all_formatters = 1 which it work for css format, but it no work for js format now.
So I think it's a config problem with neoformat, maybe something I make wrong.