> Hi,
> After reading the thread on asynchronous processes I was just looking
> at the help for the ! command which I rarely use, and after playing
> with it I realized that it translates a motion from normal mode into a
> range for an ex command, i.e. doing !2j gives you an ex command line
> of :.,+2! to start your filter with. This made me wonder: Is there a
> way to do this without the filter? In other words, instead of having
> to type :.,+2s I could get there with a 2j combined with something. I
> realize I can do it with the ! itself by just backspacing over the !
> at the end of the ex command, but is there a more 'official' way to do
> this?
No, there isn't.
But in your example, you know the number of lines you want to get in
your range, so you can type
3:
to get
:.,.+2
In general:
!2j has the form {operator}{motion}
:h operator
You can create a custom operator (and name it e.g. "g:") with
:h g@
Once it has been done here (from Jan 2008, see the whole discussion)
http://groups.google.com/group/vim_dev/msg/c6fb56645c188244
The details are somewhat tricky (if this reads better than ugly ...).
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.