Add script to attach files in neomutt using ranger

This commit is contained in:
Thomas Dehaeze 2019-07-19 22:10:01 +02:00
parent a8b3ac13b1
commit c212a0672c

View File

@ -687,9 +687,9 @@ Labels
bind compose a attach-file
#+END_SRC
Attach file using GUI File Manager
Attach multiple files using ranger
#+begin_src conf
# macro compose A "<shell-escape>bash $HOME/.config/neomut/bin/attach-file.sh<enter><enter-command>source /tmp/muttpick<enter>" "Attach with GUI"
macro compose A "<shell-escape>bash $HOME/.config/neomutt/bin/rangerpick<enter><enter-command>source /tmp/rangerpick<enter><shell-escape>bash $HOME/.config/neomutt/bin/rangerpick clean<enter>" "Attach with Ranger"
#+end_src
Write html emails using markdown
@ -702,6 +702,21 @@ Open another instance of neomutt in readonly mode while composing
macro compose M "<shell-escape>termite -e \"neomutt -R\"<enter>"
#+END_SRC
**** Attach with Ranger Script
:PROPERTIES:
:header-args: :tangle ~/.config/neomutt/bin/rangerpick
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
tmpfile=/tmp/rangerpick
if [ -z "$1" ]; then
ranger --choosefiles $tmpfile && sed -i 's/^/<attach-file>/' $tmpfile && sed -i 's/$/<enter>/' $tmpfile && sed -i ':a;N;$!ba;s/\n//g' $tmpfile && sed -i 's/^/push /' $tmpfile
elif [ $1 == "clean" ]; then
rm $tmpfile
fi
#+end_src
*** Browser
#+begin_src conf
bind browser l select-entry
@ -1184,7 +1199,7 @@ First, tag the files you want to send using =t=, then =;= to apply the action on
:END:
#+begin_src bash
if [ "$1" = "all" ]; then
arg='all'
arg='-a'
else
arg=''
fi