Being evil with narrow-to-region-indirect
Following up on my last post, here is how you can define a custom operator for evil-mode (which is where the true power of Vim comes into play).
It is trivially easy to set this up using evil-define-operator. Here is the code:
(evil-define-operator evil-narrow-indirect (beg end type)
"Indirectly narrow the region from BEG to END."
(interactive "<R>")
(evil-normal-state)
(narrow-to-region-indirect beg end))
Now all that is left is to bind it to a key! I'm using "m":
(define-key evil-normal-state-map "m" 'evil-narrow-indirect)
(define-key evil-visual-state-map "m" 'evil-narrow-indirect)
Eval all of this, and now we have everything in place to say "mit" or "mi}", etc.
