On Mon, Aug 26, 2002 at 06:53:37AM -0400, Russell Hoover wrote:
> When I am in mutt and I press 'm' to compose a new mail, and I'm then
> dropped into my editor (vim), I'd like to have it so that I'll always
> be automatically already in vim's insert mode.
> 
> Right now, once mutt puts me into vim after I press 'm',
> and I am in vim's 'normal mode' ready to compose a new mail,
> I can invoke vim's 'O' command (open a new line above the
> cursor and put the editor into insert mode) to get exactly
> what I want -- insert mode plus the new line.
> 
> What I'd like to do is put the 'O' command into a mutt macro,
> and I've forgotten how I'd do it.
> 
> I already have this:
> 
> # Start cursor at line 9 (with edit_hdrs set) when composing new mails ('m'):
> macro index   m    ":set editor='vim +9'^M_A"  "compose a new mail message"
> macro pager   m    ":set editor='vim +9'^M_A"  "compose a new mail message"
> 
> (Earlier in my .muttrc I bound "_A' to (send a) mail, ('m' by default), so
> that 'm' could be the key for the macro.)
> 
> How do I put vim's 'O' command into a this macro so that it does what
> I want?

>From the shell prompt, you could do this:

    vim +9 -c "normal O" -c startinsert

You may want to search for a pattern rather than use a line number in
case the number of header lines ever changes:

    vim +/^$ -c "normal O" -c startinsert

Now the tricky part is quoting this correctly for use in a macro.  This
worked when I tried it, without the ^M_A:

    macro index m ":set editor='vim +9 -c \"normal O\" -c startinsert'^M_A"  "compose 
a new mail message"

HTH,
Gary

-- 
Gary Johnson                               | Agilent Technologies
[EMAIL PROTECTED]                   | Spokane, Washington, USA
http://www.spocom.com/users/gjohnson/mutt/ |

Reply via email to