Share

Vim with PHP code sniffer, mess detector and code coverage

Vim is a lot more powerful than people think. Many people who use it would do so just for quickly editing a single file, but would use an IDE for their main development. But I've discovered recently that Vim is so extensible that it can do all the things that you thought it couldn't: code completion, syntax checking, project management, debugger integration and more.

Check out http://vim.wikia.com/wiki/UseVimlikeanIDE and http://arstechnica.com/open-source/guides/2009/05/vim-made-easy-how-to-get-your-favorite-ide-features-in-vim.ars for more on that.

I now use Vim as my main PHP editor, and one thing that I've managed to get working better than any other IDE I've used is integration with quality assurance tools like PHP code sniffer, PHP mess detector and clover code coverage (produced from PHPUnit tests). I've written phpqa (vim script #3980), a plugin for Vim that integrates these three tools with your code by highlighting and marking lines with violations and code coverage output. Here are some screenshots showing it at work:

PHP syntax error markerShowing PHP syntax error caused by a missing semicolon

Showing code coverage and code sniffer violationsShowing code coverage and code sniffer violations. The lines covered by tests have a yellow "C>" marker, and lines not covered have a red marker.

For more information, including installation, configuration and usage, visit the github page.

Hopefully this plugin will be useful to others, and maybe even convert some people to using it as their IDE replacement! (I know, I'm a dreamer)

← Previous post: Meme Generator plugin for Jenkins Next post: Using Vim as a PHP IDE →
comments powered by Disqus