Bill Jonas on Sat, 13 Apr 2002 02:24:36 -0400 |
On Fri, Apr 12, 2002 at 12:44:17PM -0400, gabriel rosenkoetter wrote: > It'd be totally easy for mutt to do (since it's pager already knows > how to wrap things in a pretty smart way... that is, between words), > so it couldn't be more than an afternoon's work to add what I want. > I'd like to make sure it doesn't already exist first, though. :^> The mutt team's response might be that that's properly a text editor's job. ;) I know you don't use vim, but I'll speak up for it again here. It makes it *really* easy to reflow all manner of text, whether in your regular message, in quoted material, etc, without having to shell out to fmt or par as you re-edit what's already been entered. It's the gq command, and it's followed by either a motion command (for example, {gq} will move you to the beginning of the current paragraph, and reformat the text to the end of the paragraph) or a "text object" (see ":help text-objects" from Vim), which is basically a blob of text bounded at some point, in some fashion. For example, "classic" vi already more-or-less "knows" about sentences via the ( and ) commands and paragraphs via { and }, but it has no concept of "the current sentence/paragraph/word/etc" (that is, the one that the cursor is currently in). Vim adds that, and that's basically what text objects are. Anyhow, the command I find myself using all the time while composing email is gqip , which re-formats the "inner paragraph" (that is, the current paragraph without its bounding whitespace). Even more nifty about the gq command is that if there's some special leading character at the beginning of the line, like > or # or * for example, it will re-flow the text while putting that same character at the beginning of each line, and getting rid of it when it joins the lines. For example, if I had the following: > So then I tried > the following commands: I would get: > So then I tried the following commands: This is useful, obviously, for when you only quote partial lines from an email, or if you're, say, editing the comments in a shell script. If it's a paragraph-length single line, it will Do The Right Thing as well. Oh, and your current textwidth is used to determine where to put the linebreaks. *Now* how much would you pay? Anyway, if I still haven't convinced you to at least give vim a shot, maybe I've helped others who already use it but didn't know about this feature. -- Bill Jonas * bill@billjonas.com * http://www.billjonas.com/ Developer/SysAdmin for hire! See http://www.billjonas.com/resume.html Attachment:
pgp07edfbAwWp.pgp
|
|