Vim as editor for Claws Mail

I got sick of not having Vim as my text editor for emails in Claws Mail but GVim makes my eyes bleed so I wanted proper Vim-in-a-terminal as my editor, which was not particularly straightforward.

The proper incantation was to make a script in my PATH called terminal-vim like this:

#!/bin/bash

mate-terminal --disable-factory -x vim -f "$@"

(gnome-terminal should work similarly if you’re in GNOME.)

and to set it as my external editor in Claws Mail by going to Configuration, Preferences, External Programs, and setting Text Editor to terminal-vim '%s'.

Then under Writing in Preferences, I ticked the box “Automatically launch the external editor” and all is well.

5 thoughts on “Vim as editor for Claws Mail”

  1. Hello Andy,

    I was trying to copy your approach for lxterminal (I am running lubuntu), creating an executable file in my PATH called terminal-vim:

    #!/bin/bash
    lxterminal -e vim -f “$@”

    I then followed your instructions within the claws-mail preference settings.

    Now, when I press the ‘Compose’ button, vim does indeed pop up (in the terminal) and writes to this file:
    “~/.claws-mail/tmp/tmpmsg.0x140d930”

    However, then I am lost. How do I get my text back into claws-mail?

    Thanks for your guidance,

    David

  2. Hi Andy, thanks for you reply.

    The transfer after :wq does not take place.

    In any case, claws-mail expects input in various fields (addressee, title, mail text). How do I provide input to the right place? How does claws-mail know what to do with the text I have written in vim?

    I am asking, because I could imagine that I am missing a crucial issue here…

    Thanks for your help,

    David

  3. Hi David, for the To, Subject etc. I’m afraid you just have to type them into Claw-mail. The message body is what you get to edit in Vim, but if it’s not working I can’t think of why, sorry. One other possible thought: is lxterminal connection to some existing profile or session? If so, when you exit, the process would not really end so Claws would not know to continue. If that’s not it I’m afraid I am out of ideas – sorry.

  4. Hello, just posting this for anyone who may find it useful; to use vim with xfce4-terminal, enter the following directly into claws-mail under “set external editor to:”

    xfce4-terminal –disable-server -x vim %s

    Type your message, then :wq when done.

    No script is required for this- thanks for pointing me in the right direction though. Presumably xfce4-terminal may be substituted with the terminal of your choice. Works fine on Claws 4.0.0

    This was cobbled together with additional help from the linux mint forum: https://forums.linuxmint.com/viewtopic.php?t=235830

    Thanks to all!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.