[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:
> Lately, I do more email than anything else so I figured that using vim
> for email would be a good way to learn.


> And it's really got me curious because I'm sure I'm not using it
> efficiently yet -- everyone else can't be pressing this many keystrokes
> for simpler operations, I figure. ;)

i bet even folks like Bram Moolenaar go a few hours now and then
without using every single vim feature. (that's the name on the
version six manual, so it seems reasonable to presume that bram
is a qualified vim expert.)

> > 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?  I imagined vim users had keys mapped to do
> all those common tasks.

but we've got 'u' for undo. yes, vim undoes the single last
thingie, which was lots of typing (some of which may have come
from a clipboard somewhere, but vim doesn't know about that).

and as colin said, the 'whoops' above isn't the slickest way to
do it -- it's just something that happens even to a seasoned
veteran. (at least veterans seasoned the way i am. :)

which is what the 'pastetoggle' feature is designed to help.

> 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.

when you're learning, it's sticky to try and remember things
like <ESC> } d 2 } but once you've got a handle on the commands
you use frequently, they become firmware in your brain and you
just cruise onward, without even realizing all the keys you're

now and then i'm in insert mode without knowing it, and i've
inserted a stream of ten or fifteen vim commands, and to look
at them on screen, i'm often surprised at how cryptic and
obscure they are. it always takes me longer to decode a string
of vim commands ("lemme see -- right brace, delete, left brace,
hmm...") than it does to issue them when that's what i'm after.

> Can you describe your email editing sessions with vim?  

many keystrokes, few minutes. of course, it pays to spend time
and be sure you're saying what you mean to say, so my email
sessions always take a good long time.

if you like, i could record a quick session and send you the
results as a vim macro. eek!

> 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]

dd is two keystrokes indeed. but the first one means 'delete
something' and what follows specifies exactly that.


the last one is a shortcut for d1d, so we saved you a keystroke
and you didn't even notice. :)

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

:imap <F10> XQX<ESC>gqip?XQX<CR>3s

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

heavens! why use two keystrokes when one will do? :)

:map <F11> }{d}{P
:map <F12> }{d}}P

note -- every "d" rotates cut text among your "0 - "9 registers.
just so you know. (try :reg to see more.)

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

pastetoggle to the rescue!

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

<CR>d/^-- <CR>

> Isn't that what everyone does when writing mail?

unfortunately, no. some people leave the whole previous email in
there as a convenient means of abusing bandwidth. (made worse by
answering above the questions, totally backwards.)


I use Debian/GNU Linux version 3.0;
Linux boss 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i586 unknown
DEBIAN NEWBIE TIP #38 from Alvin Oga <aoga@Mail.Linux-Consulting.com>
Curious about your NETWORK TRAFFIC? There's a whole bunch of
ways to monitor it: iptraf, showtraf, netwatch, tcpview, statnet,
or even
	tcpdump | grep 'what you want to see'
	lsof -i | grep 'LISTEN'
For network statistics try "mrtg". See the ethernet section
over at http://www.Linux-Sec.net/

Also see http://newbieDoc.sourceForge.net/ ...

Reply to: