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.

Windows Notepad Finally Supports Unix, Mac OS Line Endings

This Slashdot story links to this blog post by Microsoft.  33 years later, one of the most annoying issues with the Notepad text editor is resolved:

Starting with the current Windows 10 Insider build, Notepad will support Unix/Linux line endings (LF), Macintosh line endings (CR), and Windows Line endings (CRLF) as usual. New files created within Notepad will use Windows line ending (CRLF) by default, but it will now be possible to view, edit, and print existing files, correctly maintaining the file’s current line ending format.

They shouldn’t have invented their own line ending in the first place.  But it’s great to see that they finally acknowledge the existence of the rest of the world.

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.

Carbon – beautiful screenshots of your source code

Carbon – is a very simple, but very useful web tool for creating beautiful screenshots of the source code.  And yes, before you start correcting me, I know that source code is always more useful as a listing, which can be copy-pasted, searched, and so on, rather than an image.  But there are still plenty of scenarios when you just need it fixed and frozen.

Carbon provides plenty of flexibility in a very friendly user interface – code highlighting for a variety of programming languages and configuration files, editor themes, window controls, fonts, and more.   There’s also a very simple way to tweet the screenshot directly from Carbon, if that’s what you want to do.

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.

Vim after 15 years

Vim after 15 years” is yet another one of those “my Vim configuration review” posts by someone who has been using Vim for 15 years or so.

As someone who is also a long time Vim user, I have to say it’s quite common to review your configuration once in a while and remove some outdated bits which made it into plugins and Vim core, update plugins to newer versions, and replace plugins with newer alternatives.

spf13-vim : The Ultimate Vim Distribution

spf13-vim is an amazing Vim distribution with cross-platform configuration and a large bundle of plugins, aimed at programmers in all sorts of languages.  Those of you just starting with Vim, or using a very basic configuration, give this one a spin.  And for the rest of us, ancient farts with 10+ year old configurations, this distribution provides plenty of inspiration for plugins and configuration options to try and play with.

I’ve seen a variety of Vim distributions and bundles over the years, but nothing came close to this amazing setup.  Very well done!

Graphical vi-vim Cheat Sheet and Tutorial

Graphical vi-vim Cheat Sheet and Tutorial is yet another attempt to explain and visualize Vim commands to the editor’s new users.

This is a single page describing the full vi/vim input model, the function of all keys, and all major features. You can see it as a compressed vi/vim manual.