From bda650a7e5e72a9205112884cd7ba18198dff8f9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 7 Jun 2018 19:39:32 +1200 Subject: Replace mail_mutt.vim with mim(1df) Way better, and more generally useful. --- .gitignore | 3 +++ .gitmodules | 3 --- Makefile | 4 ++++ README.md | 1 + bin/mim.mi5 | 12 ++++++++++++ man/man1/mim.1df | 20 ++++++++++++++++++++ vim/bundle/mail_mutt | 1 - vim/vimrc | 7 ------- 8 files changed, 40 insertions(+), 11 deletions(-) create mode 100755 bin/mim.mi5 create mode 100644 man/man1/mim.1df delete mode 160000 vim/bundle/mail_mutt diff --git a/.gitignore b/.gitignore index f9ae6fcc..f809b6f8 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,9 @@ bin/med bin/mex bin/mftl bin/mi5 +bin/mim +bin/mim.sh +bin/mim.m4 bin/min bin/mkcp bin/mkmv diff --git a/.gitmodules b/.gitmodules index 82c358ff..e8e15892 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,9 +14,6 @@ [submodule "vim/bundle/insert_suspend_hlsearch"] path = vim/bundle/insert_suspend_hlsearch url = https://sanctum.geek.nz/code/vim-insert-suspend-hlsearch.git -[submodule "vim/bundle/mail_mutt"] - path = vim/bundle/mail_mutt - url = https://sanctum.geek.nz/code/vim-mail-mutt.git [submodule "vim/bundle/markdown_autoformat"] path = vim/bundle/markdown_autoformat url = https://sanctum.geek.nz/code/vim-markdown-autoformat.git diff --git a/Makefile b/Makefile index e5652913..6c9d0fab 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,7 @@ BINS = bin/ap \ bin/med \ bin/mex \ bin/mftl \ + bin/mim \ bin/min \ bin/mkcp \ bin/mkmv \ @@ -218,6 +219,7 @@ BINS = bin/ap \ BINS_M4 = bin/chn.m4 \ bin/dfv.m4 \ bin/edda.m4 \ + bin/mim.m4 \ bin/oii.m4 \ bin/pst.m4 \ bin/swr.m4 \ @@ -228,6 +230,7 @@ BINS_M4 = bin/chn.m4 \ BINS_SH = bin/chn.sh \ bin/dfv.sh \ bin/edda.sh \ + bin/mim.sh \ bin/oii.sh \ bin/pst.sh \ bin/swr.sh \ @@ -297,6 +300,7 @@ clean distclean: bin/chn.sh: bin/chn.m4 include/mktd.m4 bin/dfv.sh: bin/dfv.m4 include/mktd.m4 bin/edda.sh: bin/edda.m4 include/mktd.m4 +bin/mim.sh: bin/mim.m4 include/mktd.m4 bin/oii.sh: bin/oii.m4 include/mktd.m4 bin/pst.sh: bin/pst.m4 include/mktd.m4 bin/swr.sh: bin/swr.m4 include/mktd.m4 diff --git a/README.md b/README.md index b0ebb8e8..447e7db2 100644 --- a/README.md +++ b/README.md @@ -538,6 +538,7 @@ Installed by the `install-bin` target: it exits with success or failure. Good for quick tests. * `mex(1df)` makes given filenames in `$PATH` executable. * `mi5(1df)` is a crude preprocessor for `m4`. +* `mim(1df)` starts an interactive Mutt message with its input. * `mftl(1df)` finds usable-looking targets in makefiles. * `mkcp(1df)` creates a directory and copies preceding arguments into it. * `mkmv(1df)` creates a directory and moves preceding arguments into it. diff --git a/bin/mim.mi5 b/bin/mim.mi5 new file mode 100755 index 00000000..1c04e185 --- /dev/null +++ b/bin/mim.mi5 @@ -0,0 +1,12 @@ +# Open up Mutt to a new message starting with input + +<% +include(`include/mktd.m4') +%> + +# Direct all input (stdin and files) into a tempfile +tf=$td/out +cat -- "${@:--}" > "$tf" || exit + +# Run Mutt on the tempfile, showing it the TTY for its input +mutt -i "$tf" < /dev/tty diff --git a/man/man1/mim.1df b/man/man1/mim.1df new file mode 100644 index 00000000..e70c7fa5 --- /dev/null +++ b/man/man1/mim.1df @@ -0,0 +1,20 @@ +.TH MIM 1df "June 2018" "Manual page for mim" +.SH NAME +.B mim +\- start a new Mutt message with the input +.SH SYNOPSIS +.B mim +file1 [file2 ...] +.br +curl http://example.net/ | +.B mim +.SH DESCRIPTION +.B mim +takes all its input and puts it into a temporary file for mutt(1) to read with +its -i option, redirecting the terminal input appropriately. This allows you to +concatenate or pipe input straight into a new Mutt message. +.P +The author wrote it so that he could use ! and :! commands in Vim with it, to +email sections of buffers to people conveniently. +.SH AUTHOR +Tom Ryder diff --git a/vim/bundle/mail_mutt b/vim/bundle/mail_mutt deleted file mode 160000 index 3e0e4306..00000000 --- a/vim/bundle/mail_mutt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3e0e4306641a759758a4eb746708f0efec9cc7e8 diff --git a/vim/vimrc b/vim/vimrc index 723e69da..25907ffb 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -428,13 +428,6 @@ nmap ] PutBlankLinesBelow " \b toggles copy-pasteable linebreak settings nmap b CopyLinebreakToggle -" \m in visual/select mode starts a mail message with the selected lines -vmap m MailMuttSelected -" \m in normal mode starts a mail message with the current line -nmap m MailMuttLine -" \M in normal mode starts a mail message with the whole buffer -nmap M MailMuttBuffer - " \x strips trailing whitespace via a custom plugin nmap x StripTrailingWhitespace -- cgit v1.2.3