Created
October 30, 2017 16:38
-
-
Save philpep/a3403806fb2226a42ddcc792392d0725 to your computer and use it in GitHub Desktop.
Async editor for mutt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Async editor for mutt | |
# Usage: set editor=/path/to/this/script | |
# It spawn editor in a new background terminal so I can continue reading mail | |
# while editing. | |
# The title of the terminal is set to "mutt-edit", this allow me to make it | |
# floating in i3 with: | |
# for_window [title="mutt-edit"] floating enable | |
set -e | |
if test -z "$MUTTEDIT"; then | |
# copy and edit in a new location since mutt will remove it's draft file | |
# ($1) after this shell script exit. | |
draft=$1.mutt-edit | |
cp $1 $draft | |
xfce4-terminal --title mutt-edit -e \ | |
"/bin/sh -c \"MUTTEDIT=yes mutt -e 'set autoedit=yes; unset signature' -H $draft; \ | |
rm -f $draft\"" & | |
else | |
vim -c ':set ft=mail spell spelllang=en,fr' $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
neat idea. I couldn’t quite get it to work, but mutt now has a
background_edit
setting for composing mail in the background. Also a little clunky, but it gets the job done.