I'm playing with Meow recently. Although I don't think I'll switch to it from Evil eventually (more on that later), one of its design philosophy does make some sense: it encourages Noun-Verb text editing with visual feedback.
What does this mean?
For example, in Vim/Evil, to delete a s-exp, we usually do da)
. This is an example of Verb-Noun text editing, as d
is the verb for deleting, and a)
is the noun representing "a parentheses".
In Meow, on the other hand, with the QWERTY "default" layout, the corresponding key sequence is .rs
, where
.
(meow-bounds-of-thing
)- Activate the outer-thing prefix
r
- Round, that is, parentheses. At this point, the smallest s-exp around the cursor is selected and highlighted.
s
(meow-kill
)- Delete the highlighted region.
s
can be other actions, like i
for inserting before the region, a
for inserting after the region, etc.
Noun-Verb Text Editing for the Poor Evil Emacsen
Actually Vim/Evil allows Noun-Verb text editing out of the box.
Yes, it's just the visual state. The equivalent key sequence to the above example is va)d
. We also have the visual feedback, because it's, well, visual.
Moreover, inserting before the region / after the region actually also works. We just need to use I
and A
instead of i
and a
.
Improved Evil Noun-Verb Text Editing
If we compared va)d
to .rs
, clearly our evil solution involves an extra key input, that is v
to enter the visual state.
But we are in Emacs, hacking this is pretty easy:
(defun my-evil-inner-thing () (interactive) (evil-visual-char) (set-transient-map evil-inner-text-objects-map)) (defun my-evil-outer-thing () (interactive) (evil-visual-char) (set-transient-map evil-outer-text-objects-map)) (evil-define-key* 'normal 'global "," #'my-evil-inner-thing) (evil-define-key* 'normal 'global "." #'my-evil-outer-thing)
VoilĂ !