Composability in Vim

To the uninitiated, Vim’s command set seems a mishmash of arbitrary letter sequences that don’t seem to make any sense. To make matters worse, there are a lot of them. The truth, though, is that the commands are very regular and built up from operators, motions, and (text) objects. Once you learn that d is the command for delete you can delete letters, words, lines, paragraphs, whole files and many other objects simply by combining the d with a motion or object.

Ismail Badawi has a very nice post that explains all this in detail. The nice thing is that although you can perform hundreds of actions in vim, the number of keys you have to learn is relatively small. That makes learning and mastering vim much easier than it first appears.

The scheme is so tractive that an experienced user will know the command for an action even if they’ve never seem it before. Badawi has a story about combining the actions of two completely different plugins in the expected way and having it work as he thought it would. He says that he didn’t even think about it, he just used his muscle memory and got the right result. This despite the fact that the plugin authors almost certainly hadn’t anticipated an interaction between the two plugins and, of course, the interaction was nowhere documented.

As those of you who have been around for a while know, I was a Vi/Vim user for a long time and still think very highly of it. If you’re looking for a fast, powerful editor that concentrates on doing one thing (editing) well, Vim is for you. If you’d like an environment that allows you to do multitude of text-based tasks easily and with a single UI, Emacs is a better bet. Both are great editors; the choice boils down to what you want from your editor rather than the editor themselves.

Update [2019-08-07 Wed 14:26]: Added link to Badawi’s post.

This entry was posted in General and tagged . Bookmark the permalink.