One particular change that I want to highlight (which GitHub skipped in their highlights, but which exists in the Git release notes for this version) is the syntax pattern update for the PHP files.
If you are not sure where and how it is used, here are a couple of useful links for you:
- .gitattributes documentation section on settings the syntax of the file for diffs. Basically, you just need to add “*.php diff=php” to the .gitattributes file. Unfortunately, this is done on a per-project level, rather than globally on a user level. (See this blog post for more details).
- More info on the same subject: How Does Git Know What Functions Look Like?
Now that you have it all configured, there are a couple of ways to benefit from this functionality. First, you’ll see a more useful context comment in the diffs. Here’s the screenshot (using an older git version still). On the left, the diff without the PHP syntax configured, and on the right is the diff with the PHP syntax configured:
As you can see, on the left, the context shows that the change was done somewhere in the ChangeLogTrait trait. On the right, the context is much more specific – it shows that the change was done in the public function changelog.
This makes reviewing code changes a lot easier. But there is also one other place where this is useful – in reviewing the history of a particular function. For example, running “git log -L :changelog:ChangelogTrait.php” will produce the git log output containing only the commits and diffs on the function changelog in the file ChangelogTrait.php. Very handy!
Over the last few weeks, I have significantly changed and updated my Vim configuration. I’ve been using the editor for decades, and yet I every time I revisit my setup, I am amazed at how far the editor progressed and how wisdom the Vim community shares via themes, plugins, configuration tweaks, etc.
Here are some of the highlights this time around:
- Switched from Pathogen plugin manager (and Ansible bits) to Vundle.
- Added vim-devicons plugin and a patched font that supports them.
- Switched from Syntastic to ALE for faster and better syntax checks.
- Improved the code completion configuration, tags, and such.
- Added a whole bunch of plugins for developers.
I am still getting used to some new shortcuts, catching up on the documentation, and trying things out. But if it’s been a while since you’ve looked at your own Vim configuration, I suggest you do so. Things are moving and evolving faster than you might think.