On Mon, Mar 05, 2001 at 03:33:31PM -0800, Peter Jay Salzman wrote:
> this macro maps the home key to format your paragraphs according to what
> your textwidth is.
good info dude! I use the following, which works in VIM, and uses's VIM's
internal reformating...
map <C-W> j{gq}
j jump down a line ( setup for the next command)
{ return to top of paragraph
gq reformat
} to end of paraphraph
This version should be faster than the spawning of 'fmt', as well as the
j{ make it so the key (in this case ctrl-W) hit anywhere in a paragraph
will cause that entire paragraph to be reformatted, and then properly
positioned for the next paragraph should you choose to linger on the
ctrl-w key.
> map <kHome> !}fmt --width='.&tw<Home>exec '<End><CR>
> don't ask me to parse it. this one is beyond me. :-)
! pipe from this line
} to end of paraphaph
and the rest doesn't make much sense to me either. the .&tw I don't
recognize and couldn't make work in my VIM session (though obviously the
intention is clear), and the <Home> and <End> seem out of place. Perhaps
something in the select and paste process screwed that bit up.... ?
> vim:tw=86:
> %vim:tw=86
> % vim:tw=86:
the 'gq' version above uses's the same 'tw' setting that the fmt variant uses.
--
Ted Deppner
http://www.psyber.com/~ted/