Search code examples
vimmutt

Failed Communication Between Already-Running MacVim Instance and Mutt


I am using the mutt email client and am trying to use MacVim as my editor. I have set editor = "mvim --remote". The --remote option to mvim opens a file in an existing instance of MacVim instead of opening a new window. While this successfully opens a file in my existing MacVim instance, there are two issues:

  • mutt immediately displays the message "Aborted unmodified message.", despite the fact that a MacVim buffer was opened
  • the headers do not appear at the top of the MacVim buffer (even though I have set autoedit in my mutt config).
  • when I close the file with :wq mutt does not detect it-- it just continues showing "Aborted unmodified message."

These issues suggest that mutt is able to signal MacVim to open a new file, but is somehow unable to read/write from this file, detects this immediately, and considers the message aborted. I see the same issue if I use plain mvim or mvim -f --remote. But mvim -f works well-- my issue with it is that the startup time for MacVim is then annoyingly long due to all the plugins that get loaded. Can someone explain the mechanics of the communication between MacVim and Mutt, and whether there is a way to use the already open instance of MacVim as the editor?


Solution

  • I'm not sure why exactly this works, but I was able to get the desired functionality by using

    set editor = "mvim --remote-wait"
    

    This properly opens up the message buffer in MacVim. When the buffer is deleted, mutt resumes with access to the newly created message.