On 10/02/11 11:23 AM, Tim Chase wrote:
On 02/09/2011 06:10 PM, Ben Schmidt wrote:
an operator. I.e. so I can do things like Jap in normal mode
to join a paragraph.

If it doesn't exist I can quite easily make a little script to
do it, but I thought it was already possible.

Well, it does work if you're in visual mode, so you can do

vapJ

It's not an operator-pending mode expecting a "join over this motion"
but rather a "mark some text to operate on, and then join it", so it's
not quite what you asked for, but close enough that it might suffice
for what you want. Otherwise, you may have to go spelunking in
backwaters of 'opfunc' and "g@" to get what you want. It's still 2
characters ("g@<motion>" instead of "v<motion>J"), it would just be in
the order you want.

OK. Looks like I was wrong, then, about this existing.

I'd written something very similar in the past, so it was a cinch to
adapt it to this task, and now this snippet is living in my .vimrc:

nnoremap J :set operatorfunc=Joinoperator<CR>g@
nnoremap gJ :set operatorfunc=GJoinoperator<CR>g@
func! Joinoperator(submode)
        '[,']join
endfunc
func! GJoinoperator(submode)
        '[,']join!
endfunc

Ben.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to