Automatically check PHP / Ruby syntax on file save
One of the wicked things about VIm is that you learn a new trick every day; well, I do anyway.
I program day to day in either PHP or Ruby, and I normally run a quick syntax check when I save a file.
Previously, I would save the file and run the following from the terminal
Then I copped that I could run it without leaving VIm by entering the follwowing commands
So the next nicety was to have VIm run the check automatically when I save either a PHP or Ruby file.
Simple pop the following in your vimrc and away you go.
This simple instructs VIM that when saving a file with either extension, run the required command.
Dead handy,…. and you can swap out the extension and command required for your language of choice.