如何修复 neomuttrc 语法?

如何修复 neomuttrc 语法?

我已经安装了 Neomutt 并且运行良好一段时间了,但在某些时候我开始在启动时看到一个错误,我想最终修复它。错误说:

Error in /home/amanda/.config/neomutt/neomuttrc, line 23: 
Binding '\\' will alias '\'  Before, try: 'bind pager \ noop'  https://neomutt.org/guide/configuration.html#bind-warnings
Warning in /home/amanda/.config/neomutt/neomuttrc, line 24: 
source: errors in /home/amanda/.config/neomutt/neomuttrc

我的目标是打开\\一个不多的查询来搜索我的整个邮件目录,同时/只搜索打开的列表或查询(因此,如果我正在查看收件箱,/将打开一个提示来搜索我的收件箱,\\并将打开一个提示搜索所有邮件。

错误建议添加,bind pager \ noop但第 23 行正是这么说的。

设置我neomuttrc以便\\打开查询提示的正确方法是什么?

我的完整neomuttrc文件,以防我还缺少其他内容:

source ~/.config/neomutt/pass.sh|

set smtp_url = "smtp://[email protected]@mail.example.com:587/"
set smtp_pass = $my_pass
set ssl_force_tls = yes

set from = "[email protected]"
set realname = "Myself"

set signature = "~/.config/neomutt/signature"
set status_format = "%n new | %M in %f [%v]."
set xterm_set_titles = yes

# notmuch
set nm_default_uri="notmuch:///home/myself/Mail" # path to the maildir
set spoolfile = ~/Mail/INBOX
set record = ~/Mail/INBOX.Sent
set postponed = ~/Mail/INBOX.Drafts
set mbox_type = Maildir
set folder = ~/Mail/

# notmuch bindings
bind pager \ noop
macro index,pager \\\\ "<vfolder-from-query>"              # looks up a hand made query
macro index A "<modify-labels>+archive -unread -inbox\\n"        # tag as Archived
macro index I "<modify-labels>-inbox -unread\\n"                 # removed from inbox
macro index S "<modify-labels-then-hide>-inbox -unread +junk\\n" # tag as Junk mail
macro index + "<modify-labels>+*\\n<sync-mailbox>"               # tag as starred
macro index - "<modify-labels>-*\\n<sync-mailbox>"               # tag as unstarred

# macro pager ` <edit-label>

# ctrl u searches for URLs
macro pager \cu |urlview\n

# Remap bounce-message function to “B”
bind index B bounce-message


# show the year via http://www.sendmail.org/~ca/email/mutt/manual-6.html#index_format
set index_format = "%4C %Z %{%b %d %Y} %-15.15L (%?l?%4l&%4c?) %s"

## Save Hooks
save-hook '~s [Rr]eceipt' =INBOX.receipts
save-hook '~s order\ confirmation' =INBOX.receipts
save-hook '~s authorized\ a\ payment' =INBOX.receipts
save-hook '~e Venmo' =INBOX.receipts
save-hook .         =INBOX.Archives.%[%Y]
## Addressing
macro pager,index a "<pipe-message>khard add-email<return>" "add the sender address to khard"

set query_command= "khard email --parsable %s"
bind editor <Tab> complete-query
bind editor ^T    complete


set mailcap_path = ~/.config/mailcap
set print_command="/home/amanda/.config/neomutt/print_unicode.sh"

答案1

Neomutt\在配置文件中使用反斜杠作为转义字符。您需要转义它才能得到字面上的反斜杠。但根据您的配置文件您已经知道了。

bind   index,pager \\     noop
bind   index,pager \\\\   vfolder-from-query

您还可以使用unbind命令而不是绑定 noop 函数。

unbind index,pager \\
bind   index,pager \\\\   vfolder-from-query

如果没有特殊原因,我还建议使用bind而不是 a 。macrobind只能将单个功能绑定到该键。如果您希望所有搜索都排除某些标签,可能有一个方便的用例:

unbind index,pager \\
macro index,pager \\\\   "<vfolder-from-query>NOT tag:newsletters AND "

\将执行vfolder-from-query预填充NOT tag:newsletters AND并停留在命令提示符中等待您添加其他搜索查询参数。

相关内容