Skip to content
Michael Turquette edited this page Mar 4, 2018 · 26 revisions

You can choose whether to use an embedded editor (default, but does not work on Wayland) or external editor.

Embedded editor

The default configured editor is gvim embedded using XEmbed, but any editor or setup that support XEmbed can in principle be used.

The editor.cmd string is passed to ustring::compose, and the following arguments must be set:

filename: %1
servername: %2 (probably optional)
socketid: %3

It is important that the editor is run in the forground since the process is watched by astroid.

The embedded editor does not work on Wayland, use the external editor there.

External editor

To use an external editor, set the option editor.external_editor to true, and specify only the file argument (%1) in the editor command:

"editor": {
        "cmd": "gvim -f -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1",
        "external_editor": "true",
    },

Editor examples

gvim (default)

gvim -geom 10x10 --servername %2 --socketid %3 -f -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1

fancy gvim with Goyo and Limelight:

Embedded: gvim -geom 10x10 --servername %2 --socketid %3 -f -c 'set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' -c Goyo -c Limelight! %1
External: gvim -f -c 'set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' -c Goyo -c Limelight! %1

emacs

Embedded: emacs --parent-id %3 %1
External: emacs %1

Pro-tip: use emacsclient

External: emacsclient -q -c %1

Make sure you have the daemon running or specify a suitable -a argument.

Pro-tip: use notmuch-message-mode

You can use the notmuch-message-mode for composing email in emacs by having this in your emacs config file (replace user@localhost.domain.tld with your username and machine hostname):

(require 'notmuch)
(add-to-list 'auto-mode-alist '("user@localhost.domain.tld" . notmuch-message-mode))

neovim (through rxvt-unicode (urxvt))

urxvt -embed %3 -e nvim %1

neovim (through st)

st -f 'Monospace' -w %3 -e nvim %1

# With more font options specified
st -f 'Inconsolata:style=Bold:size=14' -w %3 -e nvim %1

You could use another terminal, but it must support XEmbed, like st.

Atom or SublimeText

"cmd": "\/Applications\/Atom.app\/Contents\/Resources\/app\/atom.sh -w %1",

or

"cmd": "\/Users\/foo\/bin\/subl -w %1",

VimR

        "cmd": "vimr --wait --nvim -c 'set ft=mail' -c 'set fileencoding=utf-8' -c 'set ff=unix' -c 'set enc=utf-8' %1",
        "external_editor": "true",

Message ID

You can configure astroid to use a specific username and hostname for the message-id:

{
    "mail": {
        "message_id_fqdn": "localhost.domain.tld",
        "message_id_user": "user"
    }
}
Clone this wiki locally