Может ли mutt автоматически форматировать сообщение для ответа на уведомления?

Я бы сделал так в скрипте bash (также будет работать в скрипте POSIX sh):

echo 'Please select a file.'

n=0
for img in ~/Desktop/ScreenShot-*.png
do
    n=$((n+1))
    printf "[%s] %s\n" "$n" "$img"
    eval "img${n}=\$img"
done

if [ "$n" -eq 0 ]
then
    echo >&2 No images found.
    exit
fi

printf 'Enter File Index ID (1 to %s): ' "$n"
read -r num
num=$(printf '%s\n' "$num" | tr -dc '[:digit:]')

if [ "$num" -le 0 ] || [ "$num" -gt "$n" ]
then
    echo >&2 Wrong selection.
    exit 1
else
    eval "IMG=\$img${num}"
    echo Selected image is "$IMG"
fi
2
16.05.2020, 13:32
1 ответ

Сначала необходимо сопоставить все сообщения, а затем конкретные сообщения, поскольку изменения конфигурации необратимы. Помните, что порядок ответов -имеет значение.

# This applies to all messages
send-hook ~A \
'set signature="/path/to/signature file";\
source.specific_vim_format_all'

# This hook applies only to those matching notifications@github.com
reply-hook notifications@github.com \
'set signature="";\
source.specific_vim_format'

Или вы можете избавиться от источника файла .specific _vim _формата , определив настройки редактора по умолчанию в переменной $my_editor. Установите в редакторе значение $my_editorдля всех сообщений, а для определенных сообщений добавьте дополнительную конфигурацию.

set my_editor="vim"
set my_editor_email_options="-c 'set syntax=mail fileencoding=utf-8 ft=mail fo+=aw'"
set my_editor_github_options="-c 'set wrap textwidth=0'"

# This applies to all messages
send-hook ~A \
'set signature="/path/to/signature file";\
set editor="$my_editor $my_editor_email_options"'

# This hook applies only to those matching notifications@github.com
reply-hook notifications@github.com \
'set signature="";\
set editor="$my_editor $my_editor_github_options"'
0
28.04.2021, 23:15

Теги

Похожие вопросы