[Gllug] formatting a paragraph in vi(m)

Stig Brautaset stig at brautaset.org
Thu Jul 26 12:14:30 UTC 2001


Is it possible in vi(m) to stand in a paragraph with bad formatting
(e.g. you just have added/deleted text in the middle of a paragraph)
and use some function similar to M-q in Emacs(*)? Or is my goal
achievable by other means? I know that vim can write portions of a
file to a new file, so maybe it is possible to make a macro that
deletes the paragraph in question, then write it to a temporary file
and run "fmt" on it and then pasting it back in the original file. It
does not sound like a very good solution, but I deem it should be
doable.

Also, Emacs also has a  function "M-<num> M-q" which block-adjust your
text, which I find is a handy tool in certain circumstances. (The rest
of  this mail  is formatted  with this  function just  to show  what I
mean.)  Is there any such possibilities in vi(m)?

[*] M-q in Emacs behaves a bit like the unix facility "fmt", albeit on
    one paragraph only. The difference is that, say you're replying to
    an email/news message.  Because of  the prefix with wich the cited
    original message becomes indented  (usually ">" pluss a space) the
    lines starts  getting awfully  long, and you  want to  amend this.
    M-q recognices the common citation prefix of the lines and formats
    the  cited text properly.  I find  this particular  aspect utterly
    usefull.   (If my  explanation here  makes no  sense to  you, open
    emacs  and try  for yourselves,  or just  feel free  to completely
    ignore me :-)

Cheers, Stig
-- 
 12:32:10 up 7 days, 18:20,  3 users,  load average: 0.10, 0.03, 0.01

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list