Raf, amazing. Thank you. Brilliant. I mapped it to K (which is unused and
it's now lightning fast) Ky!

Thank you thank you!

On Sun, Sep 5, 2021 at 8:02 PM raf <m...@raf.org> wrote:

> On Sun, Sep 05, 2021 at 05:25:16PM -0700, Tom Tunguz <ttun...@gmail.com>
> wrote:
>
> > To be clear, I've tried this:
> >
> > macro *compose* \cx ":wq<enter><send-message>"
> >
> > On Sun, Sep 5, 2021 at 5:22 PM Tom Tunguz <ttun...@gmail.com> wrote:
> >
> > > I'd like to set a macro to send mail directly from the compose window
> > > using vim.
> > >
> > > In other words, I'm responding to a mail, I reply to it, open it in
> vim.
> > > Then I want to hit a macro and have it execute :wq<enter> and then
> > > <send-message>.
> > >
> > > I've tried
> > >
> > > bind macro S ":wq<enter><send-message>"
> > >
> > > but that doesn't work. Thank you for your help!
>
> Hi, I'll be very surprised if what you are trying to do
> can work. Firstly, I think the "compose" refers to the
> compose menu
> (http://www.mutt.org/doc/manual/#intro-compose), not
> the editor, which is a separate process.
>
> If you want a macro that you can enter while in vim (to
> save the file and then tell mutt to send the message),
> it would have to be a vim macro, not a mutt macro, and
> it would have to do something like place extra
> keystrokes into stdin for mutt to consume after vim has
> terminated. That might be possible, but I wouldn't know
> how to do that. You might have luck asking on the vim
> users mailing list (but see below).
>
> But I don't really know much about the compose menu.
> Perhaps I'm wrong.
>
> However, what might work is some feature of your
> overall environment, rather than individual programs
> like mutt or vim. For example, if you use X11, and run
> vim from a xterm, and it runs vim in the same xterm
> (i.e. not gvim), then you could create the macro as an
> Xresource like XTerm*VT100.Translations. It works at
> the terminal emulator level, rather than at the level
> of the programs running within the terminal emulator.
> Maybe something like this:
>
>   ~/.xresources:
>   XTerm*VT100.Translations: #override \
>     Ctrl <Key> F1: string(":wq\ny")
>
> No, that doesn't work. The y character gets lots. Vim
> must be reading it. And I think you can only translate
> a single keystroke combination, not multiple keys like
> \cx.
>
> If you use a mac, you might be able to do something
> similar with Karabiner, or Automator.
>
> Sorry, I think I've run out of ideas. It seems like
> too much effort to save a single keystroke.
>
> But since you're willing to expend three keystrokes
> "\cx", you could probably change it to \cy or
> similar, where the \c is a vim map that does :wq<CR>
> and the y is left for mutt to consume. That seems to
> work, and you don't even need to pause before the y.
>
>   ~/.vimrc:
>   map \c :wq<CR>
>   map! \c :wq<CR>
>
> But it won't work if your editor is gvim, and its window
> isn't directly over the terminal emulator that mutt is in.
> It would be more reliable if you used vim rather than gvim
> as the editor, or make sure that your gvim window has the
> same size and position as mutt's terminal emulator window.
>
> cheers,
> raf
>
>

Reply via email to