Thanks for sharing this! I found this on Google searching for using phpcbf with
Neoformat and this got me in the right direction getting phpcbf working with
Neoformat with my setup. I ran into some odd issues when having Neoformat run
on save with:
autocmd BufWritePre *.php Neoformat
It did work fine with the <leader>nf shortcut but I prefer Neoformat to run
on save. I looked into it a bit more and it looks like there was a feature to deal with non-standard error codes made due to how phpcbf handles error codes,
and I was able to adjust your code to take advantage of that and remove the
need for the || true (which I think was causing my problem). In addition, I
don't think the --extensions=php is needed since it's already set as a PHP
formatter, so it shouldn't run on anything else. Here's an update to your code
with the fixes:
My use case is that I use a phpcs.xml file for my rules, so I don't need to
set a standard via a cli argument; and as mentioned before I like to have it
run on save, so my setup is like this:
Thanks for sharing this! I found this on Google searching for using phpcbf with
Neoformat and this got me in the right direction getting phpcbf working with
Neoformat with my setup. I ran into some odd issues when having Neoformat run
on save with:
It did work fine with the
<leader>nf
shortcut but I prefer Neoformat to runon save. I looked into it a bit more and it looks like there was
a feature to deal with non-standard error codes made due to how phpcbf handles error codes,
and I was able to adjust your code to take advantage of that and remove the
need for the
|| true
(which I think was causing my problem). In addition, Idon't think the
--extensions=php
is needed since it's already set as a PHPformatter, so it shouldn't run on anything else. Here's an update to your code
with the fixes:
My use case is that I use a
phpcs.xml
file for my rules, so I don't need toset a standard via a cli argument; and as mentioned before I like to have it
run on save, so my setup is like this:
Once again, thanks for sharing, and I hope this helps anyone else coming here via searching for how to use phpcbf with Neoformat like I did.