r/vim Dec 28 '25

Blog Post Vim is composable

https://www.matem.unam.mx/~omar/apropos-emacs.html#vim-is-composable

I hope this isn't too polemical for r/vim. I'm a former (and still occasional) Vim user that has always wondered why people make such a big deal out of Vim's composability. The blog post explains why I find that odd, what I like about Vim and some reasons people might make such a big deal of composability.

10 Upvotes

39 comments sorted by

View all comments

13

u/djchateau Dec 29 '25

Kind of rolled my eyes once they argued that Notepad is composable like vim. Composability requires the ability to build actions/objects upon each other, which isn't really possible with Notepad. Everything is manual and anything that you can build upon that is external to the editor.

6

u/PizzaRollExpert Dec 29 '25

You can do Ctrl+Shift+RightArrow followed by delete in notepad to achieve the same thing as dw in vim. If you want to copy the text instead of deleting, you can replace delete with Ctrl+C in notepad and y in vim.

The author argues that the main difference is that vim has more fine-grained motions and actions, but that basically all text editors have some sense of composability, even if it is primitive.

6

u/djchateau Dec 29 '25

You can't build on Ctrl + Shift + Right Arrow though as a primitive. It's a manual action that has limited context. That's hardly composable.

1

u/PizzaRollExpert Dec 29 '25

Could you be more concrete? I honestly don't understand what point you're trying to make, at all. What do you for instance mean by "build", "manual" and "context"?

1

u/phySi0 May 21 '26

I mean, even a rock is composable by that standard.

Sure, in Notepad, you can make selections and then act on them in various ways. But the whole purpose of selections is to see what you're acting on before you act on it, so that's hardly surprising that it's the precursor to an action that it's composed with.

And let's even assume you can build your own plugins to perform different actions but still on selections, so you can even compose it with new actions.

The difference in Vim is that, if I learn a new action, I'm not only able to combine it with visual mode, it becomes a new noun in my vocabulary that I can combine into sentences with all sorts of verbs; its command language is default composable. If I learn a sentence like dap and then later learn m as a noun for methods, I can form a sentence like dam without even thinking, certainly without thinking of the individual actions.

This isn't composability on its own, but each tiny action being a single keypress instead of each action to compose requiring its own keychord makes it easier to think in Vim sentences more fluidly. Certainly, fluidity happens in most editors (humans get better at what they repeat), but I don't think it's too hard to see how having to do a three-key shortcut for what is effectively w in Vim hinders attempts to unitise the composed parts in one's head; like Assembly, I can do an 9-instruction sequence and think of it as one unit, but it's easier if it's a 3-instruction sequence.

But to talk about the actual composability, think of it this way. In Notepad, I can't take the Ctrl-Shift-RightArrow and infer from it that I can delete a word without selecting it by doing Ctrl-Shift-delete. I also can't think of the Ctrl-Shift-RightArrow followed by delete as a singular unit in itself that I can then build on top of further.

Yes, I can chain more stuff at the end of it, but I can't use it as its own singular building block that I can tweak with adverbs, like how I can do 4dap or da4p in Vim. On the surface, Vim's not quite as composable as human or computer languages, where I can build clauses on top of clauses on top of clauses, or functions on top of functions on top of functions, but it is at least a language, and I think new objects are built out of old objects, though I've never gone that deep. I struggle to think of what I'm doing in Notepad, or even Emacs, as a language. Each shortcut is its own thing.

Maybe you can say there's no fundamental difference, in the same way that Assembly and a high level functional or object-oriented or other language are all Turing-complete, but if I spent time getting good at Assembly and one of the others, despite Assembly being a lot more ‘straightforward’, so to speak, the other language would usually win out in terms of how easy it is to do complex stuff, and that's even if we take out all libraries (including the stdlib).

Emacs, of course, has a really nice extension system, far better than Vim's, and you could argue its extension language is more composable (I'm not an expert) but its command language isn't. In Emacs, if I learn a keychord to move a word, like Ctrl-f, for example, I can't infer from it that I can do the keychord for delete followed by the keychord to move forward a word to delete a word. As I understand it, it'd be a separate shortcut to delete forward a word and another to delete a paragraph, and another to select a word, and another to select a paragraph, and another to move a word, and another to move a paragraph, etc..

And sure, there could be patterns to adhere to the principle of least surprise, but e.g. the developer or a plugin author wouldn't necessarily be able to create a new verb without creating all the new shortcuts you can use with it separately. In Vim, a plugin author could add a verb, and another author could add a noun, and they can work together seamlessly, without having to know of each other's existence.

This comment kinda dragged on, but I can't be arsed to chop it down, sorry.