I have a code linter (https://github.com/symplify/easy-coding-standard) that I can run manually from the command line, but which I'd like to run automatically in vim whenever I save a file that I've been working on.
This is what I have so far:
autocmd BufWritePost * execute '! /var/www/sites/mysite/vendor/bin/ecs check %'
Very basic, but kind of works. I'd like to improve it in lots of ways though
1) don't save the file if ecs is unhappy, unless I confirm in some way
2) don't allow vim to quit if I've used
:x and there's a problem
3) only run ecs in certain project directories
I've tried googling this problem but didn't come up with much, especially for the first point. Any help appreciated, thank you!