Is there a way to turn the "region bounded by two specific marks" into a text object similar to aw
or ap
?
I've been messing around with vi
and found it convenient to use a
and b
. and define a region and to define commands that act on the region bounded by a
and b
.
It would be nice to be able to expose a text object for this purpose in vim.
I have the following bindings in vi
for emulating something kind of like visual mode. I have some macros that set a
and b
to the boundaries of an interesting region. And another set of macros for manipulating the region bounded by a
and b
.
It's nice to be able to pick whether I want a linewise selection or not after setting the marks.
^A
and ^P
are literal control characters, in this case they set the mark a
to the beginning of the buffer or paragraph and b
to the end.
map ^A 1GmaGmb
map ^P }mb{jmak}
And other macros that do stuff to the region like indent it and dedent it.
map \. mp'a>'b`p
map \, mp'a<'b`p