Friday, October 7, 2011

Re: Define Key for: Select paragraph, join lines, autowrap margins

On 20:15 Thu 06 Oct , Roger wrote:
> > On Thu, Oct 06, 2011 at 07:36:45PM -0800, Roger wrote:
> >Here's something I've been looking for how to do for a long time now.
> >
> >Select a paragraph with uneven line counts past right margin, and
> >re-justify the text in respect to margins.
> >
> >map <F9> vipJQQ<CR>
> >
> >
> >Puts in 'v' visual mode, 'ip' selects the (inner) paragraph under the
> >cursor, 'J' joins all the lines of the selected paragraph into one line,
> >and 'Q' for re-wrap the text in respects to the margins.
> >
> >(For some reason, I had to specify 'Q' twice?)
> >
> >Works sweetly now for email! Now tell me, something like this is already
> >created for VIM.
>
> I've done some testing with the above and adding the following might also be
> also be wise as I'm usually in edit mode.
>
> imap <F9> <ESC>vipJQQ<CR>
>
>
> However, if I'm replying to an EMail, the prefixed line of ">" (ie. see
> above), will be included within the line rejoining, further embedding the
> line prefix char into the lines.
>
> I'm guessing something like search/replace (or maybe even GAWK) to first,
> detect a char prefixed line, then strip the char and add the prefix after
> reformatting is completed on an EMail.
>
> -- Roger http://rogerx.freeshell.org/
>
> -- 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

For me this works well:
map <F9> vipgw
imap <F9> <Esc>vipgqa " will end in insert mode again.
and it will not mess the lines which start with >.

Best,
Marcin

--
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

No comments: