Using Vim as a PHP IDE

Jon Cairns wrote “Using Vim as a PHP IDE” blog post a good five years ago, but a lot of it still relevant and useful. It covers all the usual – syntax highlighting, syntax checking/linting, tags and auto-completion, coding style and mess detecting, unit testing and debugging. As many other similar guides, he links to a variety of plugins and provides configuration tips.

Stack Overflow: Helping One Million Developers Exit Vim

OK, this one is socially funny and statistically cool – Stack Overflow question on how to exit Vim editor was viewed over a million times in the last few years.  Now, there’s a breakdown of all sorts of statistics about who gets stuck in Vim the most.  It’s pretty amazing the kind of questions and answers one can ponder at when having access to a lot of statistical data.

:wq

sshrc – bring your .bashrc, .vimrc, etc. with you when you ssh

sshrc looks like a handy tool, for those quick SSH sessions to machines, where you can’t setup your full environment for whatever reason (maybe a shared account or automated templating or restricted access).  Here’s a description from the project page:

sshrc works just like ssh, but it also sources the ~/.sshrc on your local computer after logging in remotely.

$ echo "echo welcome" >> ~/.sshrc
$ sshrc me@myserver
welcome

$ echo "alias ..='cd ..'" >> ~/.sshrc
$ sshrc me@myserver
$ type ..
.. is aliased to `cd ..'

You can use this to set environment variables, define functions, and run post-login commands. It’s that simple, and it won’t impact other users on the server – even if they use sshrc too. This makes sshrc very useful if you share a server with multiple users and can’t edit the server’s ~/.bashrc without affecting them, or if you have several servers that you don’t want to configure independently.

I’ve discovered it by accident when searching through packages in the Fedora repositories. So, yes, you can install it with yum/dnf.

WordPress.vim – Vim Plugin for WordPress Development

If Vim is your editor of choice, and WordPress is something you work with on a regular basis, then check out WordPress.vim – a Vim plugin for WordPress development.

Some of the features are:

  • Auto-Completion for the WordPress API
  • WordPress Hooks Integration
  • WP-CLI Integration
  • Jump to Definition in WordPress Core
  • UltiSnips Snippets
  • Syntax Highlighting for WordPress PHP files.
  • Markdown Syntax Highlighting for readme.txt
  • PHPCS Syntax Checker integrated with WordPress Coding Standards
  • Search in Codex
  • Integration with WpSeek API.
  • Readme.txt Auto Validation.

Vim setup for PHP development

Robert Basic shares his “current Vim setup for PHP development“.  He shows how setup the Gutentags plugin, jump to definitions with CtrlP plugin, display of the current file and method in the status line, add support for PHP namespaces, improve linting with Asynchronous Lint Engine, and add support for PHPStan.

Via PHPDeveloper.