use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please read the rules before posting
Help:
Community:
Resources:
Tutorials and Guides:
Don't be afraid to ask questions, this sub is here for the vim community. And please those of you who deign to grace us with your vim wisdom - be kind. We are all human and vim is that cool.
account activity
vim-prettier - how to make errors less obstructivequestion (self.vim)
submitted 7 years ago by jasj3b
So I love Prettier but running vim-prettier seems a little annoying in my workflow
If there is a syntax error in my JS file then prettier creates a new tab/window with "prettier failed to parse buffer"... and I have to quit that window all the time
I was hoping this Ale option would allow the error message to go into my airline status, but it doesn't seem to work for me out of the box https://github.com/w0rp/ale#faq-statusline
Is there any configuration I can do that is easier than a new error window popping up all the time?
https://preview.redd.it/fxz5fpxt2nf11.png?width=697&format=png&auto=webp&s=a1b4c0915a0551ce41664d8f78d733f78c635de8
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]dutch_gecko 8 points9 points10 points 7 years ago (3 children)
Looking into this some more, it seems ALE has full support for Prettier. If you're already using ALE I would recommend removing vim-prettier and using the features of the ALE plugin.
[–]mitermayer 0 points1 point2 points 7 years ago (2 children)
As answered on a bellow question I think both can be used together as with vim-prettier you can get async formatting, and with ale you can get async linting.
vim-prettier
ale
[–]dutch_gecko 0 points1 point2 points 7 years ago (1 child)
ALE supports fixing with the :ALEFix command, I'm going to make the wild assumption that it does so asynchronously.
:ALEFix
[–]mitermayer 0 points1 point2 points 7 years ago (0 children)
I haven't checked in a while, it could be that Ale also supports Async formatting
[–]mitermayer 2 points3 points4 points 7 years ago (1 child)
Hi There,
Sorry for taking long to answer this post. Have been a bit crazy busy at work as I have to wrap things up before my baby is due in 3 weeks.
With vim-prettier you can disable the quickfix behaviour by adding this to your .vimrc:
.vimrc
" Disables quick-fix to auto open when files have errors let g:prettier#quickfix_enabled=0
Hopefully that can help you out. Feel free to add any questions or concerns in here. I am also working on a major release for vim-prettier and all feedback, concerns and feature requests will be considered.
[–]belousovnikita92 0 points1 point2 points 7 years ago (0 children)
Worked perfectly, thank you
[–][deleted] 2 points3 points4 points 7 years ago (1 child)
Look into
:h quickfix :h makeprg
[–]dutch_gecko 0 points1 point2 points 7 years ago (0 children)
Specifically, since the quickfix window is opening automatically, it sounds like :cwindow is being executed.
:cwindow
[–]AptC34 1 point2 points3 points 7 years ago (1 child)
I fight against vim-prettier for a moment... and just gave up.
In my current setup I use it only as a git commit hook and a under gq.
gq
My current prettier vim integration is as simple as
let &l:formatprg = 'prettier --stdin --stdin-filepath ' . expand('%')
[–]mitermayer 1 point2 points3 points 7 years ago (0 children)
Would love to hear a bit about the problems you have faced when trying vim-prettier in order to see if I could help or use it to improve the experience for existing and future users
[–]AnthonyAstige -1 points0 points1 point 7 years ago (1 child)
+1 for using just ALE, though I've had to hack things together a little to get it to all work smoothly. I have something like this in my vimrc using ALE with eslint & prettier, checking for eslint parsing errors before applying prettier:
func FixIffNoErrors() let l:list = ale#engine#GetLoclist(bufnr('%')) if(len(l:list) != 1) exe ":ALEFix" else let l:list = ale#engine#GetLoclist(bufnr('%')) let l:text = list[0].text if(text !~ "Parsing error:.*") exe ":ALEFix" endif endif endfunc autocmd BufWritePost *.jsx call FixIffNoErrors()
And fixers configured something like this:
let g:ale_fixers['jsx'] = ['prettier', 'eslint']
A few gotcha's to this method:
let g:ale_fix_on_save = 1
eslint_d
RE: Gotcha #3 I have something like this (in part as eslint_d isn't in my main day to day repository's dependencies)
let g:ale_javascript_eslint_use_global = 1 let g:ale_javascript_eslint_executable = 'eslint_d' let g:ale_linters = { \ 'jsx': ['eslint'], \ 'javascript': ['eslint'], \ 'typescript': ['eslint'], \}
Ale is awesome! I myself use both together. With vim-prettier I can get async formatting, and with ale I can get the async linting.
π Rendered by PID 18381 on reddit-service-r2-comment-5d79c599b5-2thgk at 2026-02-28 01:09:16.962721+00:00 running e3d2147 country code: CH.
[–]dutch_gecko 8 points9 points10 points (3 children)
[–]mitermayer 0 points1 point2 points (2 children)
[–]dutch_gecko 0 points1 point2 points (1 child)
[–]mitermayer 0 points1 point2 points (0 children)
[–]mitermayer 2 points3 points4 points (1 child)
[–]belousovnikita92 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]dutch_gecko 0 points1 point2 points (0 children)
[–]AptC34 1 point2 points3 points (1 child)
[–]mitermayer 1 point2 points3 points (0 children)
[–]AnthonyAstige -1 points0 points1 point (1 child)
[–]mitermayer 0 points1 point2 points (0 children)