[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mutt + Vim tricks (replace Nano)



On Sun, Oct 26, 2003 at 08:24:31PM -0800, Bill Moseley wrote:
> On Sun, Oct 26, 2003 at 06:27:11PM -0600, Will Trillich wrote:
> > quite. i've learned to have a blank line going before i paste in
> > some goodies, to make it easier to delete if i've got autoindent
> > on (or paste off):
> > 
> > 	type type type <newline>
> > 	<newline>
> > 	<paste>
> > 	whoops! icky formatting -- <esc> d { {
> 
> Whew.  And it's really 
> 
>   <esc> d shift { { i
> 
> See why I miss ^U for undo?

Undo is 'u' in command mode. Redo is Ctrl-R.

> I imagined vim users had keys mapped to do all those common tasks.

What Monique said about the home row and about composing operations.

Also, I don't even think about operations I carry out in vi. My
hindbrain has worked out what to do and got my fingers to do it long
before I'm consciously aware of it. I don't think "d{{", I think "delete
last paragraph, then go back another paragraph"; and I certainly don't
think about the <Esc> to return to command mode and the i to enter
insert mode on either side of that.

I probably operate vim far more quickly than most people operate their
simpler editors, but the difference is that when I need to do something
more complicated than the simple editor provides a single keystroke for,
it's very likely just an obvious extension to the vim command I know
already: perhaps just adding a number prefix or changing a motion
character. You complain about "gqap" versus "^J", but what happens if
you have some more intricate formatting and need to justify just the
current line? "gqq". All the way to the end of the file? "gqG". The next
five paragraphs? "{gq5}". Simpler editors really do seem crude and
limiting to me these days, even if they do provide some single- or
double-keypress facilities for actions their programmers thought were
common.

So yes, real vi users do use those key sequences you regard as
prohibitively long; they also do editing that goes beyond the trivial in
half the time it'd take others to do it and without much thought, and
the key sequences they use to do this are logical extensions of the ones
they use for trivial editing.

> Now is the time I'd like that short-cut to cut all text from here to my
> signature line.   <esc> V (down, down, down) x.  Now, I'm sure I'm doing
> that the hard way.

Easy enough to map a macro which sets a mark, searches for "^-- $", sets
another mark, returns to the first mark, and deletes everything up to
the second mark. Write it once and map it to a key sequence you prefer.
Also, see below.

> Can you describe your email editing sessions with vim?  
> 
> Seems like a simple use of an editor: 
> 
> - I prune text (dd is one extra keystroke, <esc> shift v, down,
>   down, down, is also too many strokes) [^K in nano]

I think "ooh, I want to delete about 10 lines here" and type 10dd. Or,
to delete a large chunk of text, I might hit v, search for the start of
what I want to keep, move to the end of the previous line, and hit d.

> - I edit paragraphs and re-justify them as I type [^J]

gq} often and reflexively, and usually draw a visual area over the whole
thing and hit gq just before I quit.

> - I move text/paragraphs up/down.  [^K^K^K move and ^U to paste]

v}}}d to delete; p to paste. Season to taste.

> - I paste in text and code examples that I don't want 
>   wrapped (and often want indented).

Will does this the hard way. :) I have 'set pastetoggle=<F11>' in
~/.vimrc. So I hit F11, paste, hit F11 again. To indent, let's say ':set
sw=2' (for two spaces) if that isn't set already, select what I've just
pasted, and hit >.

> - I trim left over text down to my sig.

See above. You could also ensure a blank line above your signature
(which my mailer inserts by default) and delete the remaining quoted
text as a single paragraph. For example, when writing this mail, I
zapped the remaining text I'd quoted from you with a simple d} after I'd
finished typing my last paragraph.

Of course, I don't think about any of this. My fingers pretty much do it
for me.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: