commandlinefu – a place to share and gather command line wisdom

commandlinefu is a place to learn and share your knowledge about command line tools and techniques.  It has thousands of tips, tricks, and handy shortcuts, covering a wide range of tools from shells and editors to version control and remote access.

Vim, cfdo, Ale and RipGrep

This blog post goes over several grep-like tools and their integration with Vim.  If that’s something you do often, it’s worth a read.  The tools are:

  • Vim’s built-in “:cdo” and “:cfdo” commands.  Here’s another blog post with a nice explanation of what these are and how to use them.
  • Ale – asynchronous lint engine.
  • RipGrep – a very fast tool for recursively searching directories for a regular expression.  Extra bits for Vim integration are provided by the vim-ripgrep plugin.

Zeal + Vim = offline CakePHP (and other) documentation

As any long time Vim user, I’m constantly looking for ways to tweak and improve my text editor configuration, and make me even more efficient.  Today, I came across a very handy addition – Zeal – an offline documentation browser for developers. (Thanks to this blog post, which also mentions Dash as an alternative for those of you on the MacOS.)

With Zeal, you can download a whole lot of documentation sets for pretty much any web development technology out there – programming languages, frameworks, libraries, tools, and more.  And then you can easily integrate Zeal with whatever text editor or IDE you are using.

For Vim, there are, as always, several options.  Some of them are listed here. I personally opted for the Zeavim plugin.  The installation is straight forward and everything works out of the box.  After giving a quick try, I decided to adjust my .vimrc file to use CakePHP framework documentation together with the PHP programming language documentation whenever I’m working with any PHP file.  Here’s what I had to add:

" Zeal offline documentation
let g:zv_file_types = {
       \ 'php': 'cakephp,php',
       \ }

Now, whenever I edit a PHP file and hit “,z” (I use comma as a leader, by the way), Zeal window pops up with the relevant documentation search.

It’s super fast. It works offline, and it’s awesome!

Vim as a PHP IDE – the complete guide

Vim as a PHP IDE – the complete guide” is yet another one of those lengthy articles on how to setup Vim as an IDE (Integrated Development Environment), specifically so for PHP developers.

Over the years, it’s interesting to see how with more powerful Vim, such guides become more and more focused on the selection and configuration of the plugins, rather than on tweaking Vim configuration.

Turning vim into an IDE through vim plugins

Turning vim into an IDE through vim plugins” is yet another take on customizing the Vim text editor and making it into a full featured IDE.  Most of these things were possible for years (I even had my own blog post on the subject), but with every version of Vim it gets easier and easier to setup a more advanced developer environment.