Posts tagged text-editing vim emacs composiphrase
One of the best ideas in Vi and Vim, which I rightfully see praised online frequently, is the idea of a “composable text editing language”.
Vi has a bunch of movements, like w
for “forward word”, and some operations, like d
for “delete”, and you can put them together.
dw
deletes forward one word.
You can also add a number: 4dw
deletes 4 words.
Vim adds “text objects”, which are “selection” instead of movement, eg. select a word, a sentence, etc.
You can also compose these with commands, so diw
deletes a word, di)
deletes inside parentheses, etc.
But what if we took the ideas of composability and language more seriously?
As mentioned last time, I’ve been reconsidering visual line mode.
Don’t get me wrong, I love visual line mode.
But vi and its descendants are very line-centric.
Lines are first-class, while every other way of looking at or splitting up the text, or “text object”, is sort of second class.
There are so many features of vi and vim that operate on lines specifically, that just don’t work with other ways of looking at text.
Eg. ex mode operates specifically on lines, or ranges of lines, and specifically not on character regions with partial lines.
Visual line mode and paste work together to operate cleanly on lines.
The default keymap has keys that work extra conveniently on lines.
There is an extra goto-line command, and marks have extra line mode instead of just going to the mark position.
Etc.
While I’ve shed evil-mode, I still want to use modal editing🗽, of course.
I wanted to shed the on-character cursor positioning as discussed previously, among other things.
I considered several modal editing packages in emacs, and... ok, yeah, I wrote my own.
I feel like I need to justify this.
The biggest mistake of vi-style editors is that it positions the cursor on characters instead of between characters.