l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:02

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] two nice vim tips
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] two nice vim tips

  • Subject: Re: [vox-tech] two nice vim tips
  • From: Ted Deppner <ted@psyber.MAPScom>
  • Date: Mon, 05 Mar 2001 21:07:47 -0800
  • References: 20010305153331.A1755@dirac.org

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

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!