[PLUG] Justify quoted text under Vim ?

Sandy Herring sandy at herring.org
Sat Jul 19 13:21:02 UTC 2003


On Sat, 19 Jul 2003, Felix Lee wrote: 
> Tyler Creelan <creelan at engr.orst.edu>:
> > Under pine/pico, I used to do this using the "C-j" or justify command.
> > The 'gq}' command works under Vim for regular paragraphs, but not for 
> > these when the quotes should be preserved. Any ideas? 
> 
> Umm, gq} works for me.  '>' is one of the default comment
> characters, and vim knows how to fill comments.
> 
>     :set comments? formatoptions?
>       comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
>       formatoptions=tcq
> 
> Oh, I guess this isn't the default if 'set compatible' is on.
> When 'compatible' is on, the default for formatoptions is 'vt',
> which doesn't include comment formatting.
> --

And if you want to bind pine-like keystrokes to the command, in your .vimrc
you can include...

" Formatting the current paragraph according to
" the current 'textwidth' with ^J (control-j):
  nmap <C-J>      gq}
  vmap <C-J>      gq

The `vmap' command is for visual mode - you would highlight the text to be
mapped before doing the ^J.

Sandy
-- 
Sandy Herring, RHCE                        o              sandy at herring.org
Peck of Pickled Pisces               __  o               http://herring.org/
UNIX or Web authoring questions?  |\/ o\  o  http://herring.org/finger.html
->http://herring.org/techie.html  |/\__/     http://herring.org/pub-key.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20030719/9108569c/attachment.asc>


More information about the PLUG mailing list