1 /**
2  * @file
3  * Definitions of user functions
4  *
5  * @authors
6  * Copyright (C) 1996-2000,2002 Michael R. Elkins <me@mutt.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 /**
24  * @page neo_functions Definitions of user functions
25  *
26  * Definitions of user functions
27  *
28  * This file contains the structures needed to parse "bind" commands, as well
29  * as the default bindings for each menu.
30  *
31  * Notes:
32  *
33  * - If you need to bind a control char, use the octal value because the `\cX`
34  *   construct does not work at this level.
35  *
36  * - The magic "map:" comments define how the map will be called in the manual.
37  *   Lines starting with "**" will be included in the manual.
38  */
39 
40 #include "config.h"
41 #ifdef _MAKEDOC
42 #include "docs/makedoc_defs.h"
43 #else
44 #include <stddef.h>
45 #include "keymap.h"
46 #include "opcodes.h"
47 #endif
48 
49 // clang-format off
50 /**
51  * OpGeneric - Key bindings for the generic menu
52  */
53 const struct Binding OpGeneric[] = { /* map: generic */
54   /*
55   ** <para>
56   ** The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
57   ** (such as movement) available in all menus except for <emphasis>pager</emphasis> and
58   ** <emphasis>editor</emphasis>.  Changing settings for this menu will affect the default
59   ** bindings for all menus (except as noted).
60   ** </para>
61   */
62   { "bottom-page",     OP_BOTTOM_PAGE,          "L" },
63   { "check-stats",     OP_CHECK_STATS,          NULL },
64   { "current-bottom",  OP_CURRENT_BOTTOM,       NULL },
65   { "current-middle",  OP_CURRENT_MIDDLE,       NULL },
66   { "current-top",     OP_CURRENT_TOP,          NULL },
67   { "end-cond",        OP_END_COND,             NULL },
68   { "enter-command",   OP_ENTER_COMMAND,        ":" },
69   { "exit",            OP_EXIT,                 "q" },
70   { "first-entry",     OP_FIRST_ENTRY,          "=" },
71   { "half-down",       OP_HALF_DOWN,            "]" },
72   { "half-up",         OP_HALF_UP,              "[" },
73   { "help",            OP_HELP,                 "?" },
74   { "jump",            OP_JUMP,                 NULL },
75   { "last-entry",      OP_LAST_ENTRY,           "*" },
76   { "middle-page",     OP_MIDDLE_PAGE,          "M" },
77   { "next-entry",      OP_NEXT_ENTRY,           "j" },
78   { "next-line",       OP_NEXT_LINE,            ">" },
79   { "next-page",       OP_NEXT_PAGE,            "z" },
80   { "previous-entry",  OP_PREV_ENTRY,           "k" },
81   { "previous-line",   OP_PREV_LINE,            "<" },
82   { "previous-page",   OP_PREV_PAGE,            "Z" },
83   { "refresh",         OP_REDRAW,               "\014" },                       // <Ctrl-L>
84   { "search",          OP_SEARCH,               "/" },
85   { "search-next",     OP_SEARCH_NEXT,          "n" },
86   { "search-opposite", OP_SEARCH_OPPOSITE,      NULL },                         // <Enter>
87   { "search-reverse",  OP_SEARCH_REVERSE,       "\033/" },                      // <Alt-/>
88   { "select-entry",    OP_GENERIC_SELECT_ENTRY, "\n" },                         // <Enter>
89   { "select-entry",    OP_GENERIC_SELECT_ENTRY, "\r" },                         // <Return>
90   { "shell-escape",    OP_SHELL_ESCAPE,         "!" },
91   { "tag-entry",       OP_TAG,                  "t" },
92   { "tag-prefix",      OP_TAG_PREFIX,           ";" },
93   { "tag-prefix-cond", OP_TAG_PREFIX_COND,      NULL },
94   { "top-page",        OP_TOP_PAGE,             "H" },
95   { "what-key",        OP_WHAT_KEY,             NULL },
96   { NULL, 0, NULL },
97 };
98 
99 /**
100  * OpMain - Key bindings for the index menu
101  */
102 const struct Binding OpMain[] = { /* map: index */
103 #ifdef USE_AUTOCRYPT
104   { "autocrypt-acct-menu",       OP_AUTOCRYPT_ACCT_MENU,            "A" },
105 #endif
106   { "bounce-message",            OP_BOUNCE_MESSAGE,                 "b" },
107   { "break-thread",              OP_MAIN_BREAK_THREAD,              "#" },
108 #ifdef USE_NNTP
109   { "catchup",                   OP_CATCHUP,                        NULL },
110 #endif
111   { "change-folder",             OP_MAIN_CHANGE_FOLDER,             "c" },
112   { "change-folder-readonly",    OP_MAIN_CHANGE_FOLDER_READONLY,    "\033c" },  // <Alt-c>
113 #ifdef USE_NNTP
114   { "change-newsgroup",          OP_MAIN_CHANGE_GROUP,              "i" },
115   { "change-newsgroup-readonly", OP_MAIN_CHANGE_GROUP_READONLY,     "\033i" },  // <Alt-i>
116 #endif
117 #ifdef USE_NOTMUCH
118   { "change-vfolder",            OP_MAIN_CHANGE_VFOLDER,            NULL },
119 #endif
120   { "check-traditional-pgp",     OP_CHECK_TRADITIONAL,              "\033P" },  // <Alt-P>
121   { "clear-flag",                OP_MAIN_CLEAR_FLAG,                "W" },
122   { "collapse-all",              OP_MAIN_COLLAPSE_ALL,              "\033V" },  // <Alt-V>
123   { "collapse-thread",           OP_MAIN_COLLAPSE_THREAD,           "\033v" },  // <Alt-v>
124   { "compose-to-sender",         OP_COMPOSE_TO_SENDER,              NULL },
125   { "copy-message",              OP_COPY_MESSAGE,                   "C" },
126   { "create-alias",              OP_CREATE_ALIAS,                   "a" },
127   { "decode-copy",               OP_DECODE_COPY,                    "\033C" },  // <Alt-C>
128   { "decode-save",               OP_DECODE_SAVE,                    "\033s" },  // <Alt-s>
129   { "decrypt-copy",              OP_DECRYPT_COPY,                   NULL },
130   { "decrypt-save",              OP_DECRYPT_SAVE,                   NULL },
131   { "delete-message",            OP_DELETE,                         "d" },
132   { "delete-pattern",            OP_MAIN_DELETE_PATTERN,            "D" },
133   { "delete-subthread",          OP_DELETE_SUBTHREAD,               "\033d" },  // <Alt-d>
134   { "delete-thread",             OP_DELETE_THREAD,                  "\004" },   // <Ctrl-D>
135   { "display-address",           OP_DISPLAY_ADDRESS,                "@" },
136   { "display-message",           OP_DISPLAY_MESSAGE,                "\n" },     // <Enter>
137   { "display-message",           OP_DISPLAY_MESSAGE,                "\r" },     // <Return>
138   { "display-toggle-weed",       OP_DISPLAY_HEADERS,                "h" },
139   { "edit",                      OP_EDIT_RAW_MESSAGE,               NULL },
140   { "edit-label",                OP_EDIT_LABEL,                     "Y" },
141   { "edit-or-view-raw-message",  OP_EDIT_OR_VIEW_RAW_MESSAGE,       "e" },
142   { "edit-raw-message",          OP_EDIT_RAW_MESSAGE,               NULL },
143   { "edit-type",                 OP_EDIT_TYPE,                      "\005" },   // <Ctrl-E>
144 #ifdef USE_NOTMUCH
145   { "entire-thread",             OP_MAIN_ENTIRE_THREAD,             NULL },
146 #endif
147   { "extract-keys",              OP_EXTRACT_KEYS,                   "\013" },   // <Ctrl-K>
148 #ifdef USE_POP
149   { "fetch-mail",                OP_MAIN_FETCH_MAIL,                "G" },
150 #endif
151   { "flag-message",              OP_FLAG_MESSAGE,                   "F" },
152 #ifdef USE_NNTP
153   { "followup-message",          OP_FOLLOWUP,                       NULL },
154 #endif
155   { "forget-passphrase",         OP_FORGET_PASSPHRASE,              "\006" },   // <Ctrl-F>
156   { "forward-message",           OP_FORWARD_MESSAGE,                "f" },
157 #ifdef USE_NNTP
158   { "forward-to-group",          OP_FORWARD_TO_GROUP,               NULL },
159   { "get-children",              OP_GET_CHILDREN,                   NULL },
160   { "get-message",               OP_GET_MESSAGE,                    NULL },
161   { "get-parent",                OP_GET_PARENT,                     NULL },
162 #endif
163   { "group-chat-reply",          OP_GROUP_CHAT_REPLY,               NULL },
164   { "group-reply",               OP_GROUP_REPLY,                    "g" },
165 #ifdef USE_IMAP
166   { "imap-fetch-mail",           OP_MAIN_IMAP_FETCH,                NULL },
167   { "imap-logout-all",           OP_MAIN_IMAP_LOGOUT_ALL,           NULL },
168 #endif
169   { "limit",                     OP_MAIN_LIMIT,                     "l" },
170   { "limit-current-thread",      OP_LIMIT_CURRENT_THREAD,           NULL },
171   { "link-threads",              OP_MAIN_LINK_THREADS,              "&" },
172   { "list-reply",                OP_LIST_REPLY,                     "L" },
173   { "list-subscribe",            OP_LIST_SUBSCRIBE,                 NULL },
174   { "list-unsubscribe",          OP_LIST_UNSUBSCRIBE,               NULL },
175   { "mail",                      OP_MAIL,                           "m" },
176   { "mail-key",                  OP_MAIL_KEY,                       "\033k" },  // <Alt-k>
177   { "mailbox-list",              OP_MAILBOX_LIST,                   "." },
178   { "mark-message",              OP_MARK_MSG,                       "~" },
179   { "modify-labels",             OP_MAIN_MODIFY_TAGS,               NULL }, // NOTE(sileht): kept for backward compatibility
180   { "modify-labels-then-hide",   OP_MAIN_MODIFY_TAGS_THEN_HIDE,     NULL }, // NOTE(sileht): kept for backward compatibility
181   { "modify-tags",               OP_MAIN_MODIFY_TAGS,               NULL },
182   { "modify-tags-then-hide",     OP_MAIN_MODIFY_TAGS_THEN_HIDE,     NULL },
183   { "next-new",                  OP_MAIN_NEXT_NEW,                  NULL },
184   { "next-new-then-unread",      OP_MAIN_NEXT_NEW_THEN_UNREAD,      "\t" },     // <Tab>
185   { "next-subthread",            OP_MAIN_NEXT_SUBTHREAD,            "\033n" },  // <Alt-n>
186   { "next-thread",               OP_MAIN_NEXT_THREAD,               "\016" },   // <Ctrl-N>
187   { "next-undeleted",            OP_MAIN_NEXT_UNDELETED,            "j" },
188   { "next-unread",               OP_MAIN_NEXT_UNREAD,               NULL },
189   { "next-unread-mailbox",       OP_MAIN_NEXT_UNREAD_MAILBOX,       NULL },
190   { "parent-message",            OP_MAIN_PARENT_MESSAGE,            "P" },
191   { "pipe-message",              OP_PIPE,                           "|" },
192 #ifdef USE_NNTP
193   { "post-message",              OP_POST,                           NULL },
194 #endif
195   { "previous-new",              OP_MAIN_PREV_NEW,                  NULL },
196   { "previous-new-then-unread",  OP_MAIN_PREV_NEW_THEN_UNREAD,      "\033\t" }, // <Alt-\>
197   { "previous-subthread",        OP_MAIN_PREV_SUBTHREAD,            "\033p" },  // <Alt-p>
198   { "previous-thread",           OP_MAIN_PREV_THREAD,               "\020" },   // <Ctrl-P>
199   { "previous-undeleted",        OP_MAIN_PREV_UNDELETED,            "k" },
200   { "previous-unread",           OP_MAIN_PREV_UNREAD,               NULL },
201   { "print-message",             OP_PRINT,                          "p" },
202   { "purge-message",             OP_PURGE_MESSAGE,                  NULL },
203   { "purge-thread",              OP_PURGE_THREAD,                   NULL },
204   { "quasi-delete",              OP_MAIN_QUASI_DELETE,              NULL },
205   { "query",                     OP_QUERY,                          "Q" },
206   { "quit",                      OP_QUIT,                           "q" },
207   { "read-subthread",            OP_MAIN_READ_SUBTHREAD,            "\033r" },  // <Alt-r>
208   { "read-thread",               OP_MAIN_READ_THREAD,               "\022" },   // <Ctrl-R>
209   { "recall-message",            OP_RECALL_MESSAGE,                 "R" },
210 #ifdef USE_NNTP
211   { "reconstruct-thread",        OP_RECONSTRUCT_THREAD,             NULL },
212 #endif
213   { "reply",                     OP_REPLY,                          "r" },
214   { "resend-message",            OP_RESEND,                         "\033e" },  // <Alt-e>
215   { "root-message",              OP_MAIN_ROOT_MESSAGE,              NULL },
216   { "save-message",              OP_SAVE,                           "s" },
217   { "set-flag",                  OP_MAIN_SET_FLAG,                  "w" },
218   { "show-limit",                OP_MAIN_SHOW_LIMIT,                "\033l" },  // <Alt-l>
219   { "show-log-messages",         OP_SHOW_LOG_MESSAGES,              "M" },
220   { "show-version",              OP_VERSION,                        "V" },
221 #ifdef USE_SIDEBAR
222   { "sidebar-first",             OP_SIDEBAR_FIRST,                  NULL },
223   { "sidebar-last",              OP_SIDEBAR_LAST,                   NULL },
224   { "sidebar-next",              OP_SIDEBAR_NEXT,                   NULL },
225   { "sidebar-next-new",          OP_SIDEBAR_NEXT_NEW,               NULL },
226   { "sidebar-open",              OP_SIDEBAR_OPEN,                   NULL },
227   { "sidebar-page-down",         OP_SIDEBAR_PAGE_DOWN,              NULL },
228   { "sidebar-page-up",           OP_SIDEBAR_PAGE_UP,                NULL },
229   { "sidebar-prev",              OP_SIDEBAR_PREV,                   NULL },
230   { "sidebar-prev-new",          OP_SIDEBAR_PREV_NEW,               NULL },
231   { "sidebar-toggle-virtual",    OP_SIDEBAR_TOGGLE_VIRTUAL,         NULL },
232   { "sidebar-toggle-visible",    OP_SIDEBAR_TOGGLE_VISIBLE,         NULL },
233 #endif
234   { "sort-mailbox",              OP_SORT,                           "o" },
235   { "sort-reverse",              OP_SORT_REVERSE,                   "O" },
236   { "sync-mailbox",              OP_MAIN_SYNC_FOLDER,               "$" },
237   { "tag-pattern",               OP_MAIN_TAG_PATTERN,               "T" },
238   { "tag-subthread",             OP_TAG_SUBTHREAD,                  NULL },
239   { "tag-thread",                OP_TAG_THREAD,                     "\033t" },  // <Alt-t>
240   { "toggle-new",                OP_TOGGLE_NEW,                     "N" },
241   { "toggle-read",               OP_TOGGLE_READ,                    NULL },
242   { "toggle-write",              OP_TOGGLE_WRITE,                   "%" },
243   { "undelete-message",          OP_UNDELETE,                       "u" },
244   { "undelete-pattern",          OP_MAIN_UNDELETE_PATTERN,          "U" },
245   { "undelete-subthread",        OP_UNDELETE_SUBTHREAD,             "\033u" },  // <Alt-u>
246   { "undelete-thread",           OP_UNDELETE_THREAD,                "\025" },   // <Ctrl-U>
247   { "untag-pattern",             OP_MAIN_UNTAG_PATTERN,             "\024" },   // <Ctrl-T>
248 #ifdef USE_NOTMUCH
249   { "vfolder-from-query",        OP_MAIN_VFOLDER_FROM_QUERY,        NULL },
250   { "vfolder-from-query-readonly", OP_MAIN_VFOLDER_FROM_QUERY_READONLY, NULL },
251   { "vfolder-window-backward",   OP_MAIN_WINDOWED_VFOLDER_BACKWARD, NULL },
252   { "vfolder-window-forward",    OP_MAIN_WINDOWED_VFOLDER_FORWARD,  NULL },
253   { "vfolder-window-reset",      OP_MAIN_WINDOWED_VFOLDER_RESET,    NULL },
254 #endif
255   { "view-attachments",          OP_VIEW_ATTACHMENTS,               "v" },
256   { "view-raw-message",          OP_VIEW_RAW_MESSAGE,               NULL },
257   /* This is deprecated.  Leave it last so it doesn't show up in the help. */
258   { "buffy-list",                OP_MAILBOX_LIST,                   NULL },
259   { NULL, 0, NULL },
260 };
261 
262 /**
263  * OpPager - Key bindings for the pager menu
264  */
265 const struct Binding OpPager[] = { /* map: pager */
266   { "bottom",                    OP_PAGER_BOTTOM,                 NULL },
267   { "bounce-message",            OP_BOUNCE_MESSAGE,               "b" },
268   { "break-thread",              OP_MAIN_BREAK_THREAD,            "#" },
269   { "change-folder",             OP_MAIN_CHANGE_FOLDER,           "c" },
270   { "change-folder-readonly",    OP_MAIN_CHANGE_FOLDER_READONLY,  "\033c" },    // <Alt-c>
271 #ifdef USE_NNTP
272   { "change-newsgroup",          OP_MAIN_CHANGE_GROUP,            "i" },
273   { "change-newsgroup-readonly", OP_MAIN_CHANGE_GROUP_READONLY,   "\033i" },    // <Alt-i>
274 #endif
275 #ifdef USE_NOTMUCH
276   { "change-vfolder",            OP_MAIN_CHANGE_VFOLDER,          NULL },
277 #endif
278   { "check-stats",               OP_CHECK_STATS,                  NULL },
279   { "check-traditional-pgp",     OP_CHECK_TRADITIONAL,            "\033P" },    // <Alt-P>
280   { "clear-flag",                OP_MAIN_CLEAR_FLAG,              "W" },
281   { "compose-to-sender",         OP_COMPOSE_TO_SENDER,            NULL },
282   { "copy-message",              OP_COPY_MESSAGE,                 "C" },
283   { "create-alias",              OP_CREATE_ALIAS,                 "a" },
284   { "decode-copy",               OP_DECODE_COPY,                  "\033C" },    // <Alt-C>
285   { "decode-save",               OP_DECODE_SAVE,                  "\033s" },    // <Alt-s>
286   { "decrypt-copy",              OP_DECRYPT_COPY,                 NULL },
287   { "decrypt-save",              OP_DECRYPT_SAVE,                 NULL },
288   { "delete-message",            OP_DELETE,                       "d" },
289   { "delete-subthread",          OP_DELETE_SUBTHREAD,             "\033d" },    // <Alt-d>
290   { "delete-thread",             OP_DELETE_THREAD,                "\004" },     // <Ctrl-D>
291   { "display-address",           OP_DISPLAY_ADDRESS,              "@" },
292   { "display-toggle-weed",       OP_DISPLAY_HEADERS,              "h" },
293   { "edit",                      OP_EDIT_RAW_MESSAGE,             NULL },
294   { "edit-label",                OP_EDIT_LABEL,                   "Y" },
295   { "edit-or-view-raw-message",  OP_EDIT_OR_VIEW_RAW_MESSAGE,     "e" },
296   { "edit-raw-message",          OP_EDIT_RAW_MESSAGE,             NULL },
297   { "edit-type",                 OP_EDIT_TYPE,                    "\005" },     // <Ctrl-E>
298   { "enter-command",             OP_ENTER_COMMAND,                ":" },
299 #ifdef USE_NOTMUCH
300   { "entire-thread",             OP_MAIN_ENTIRE_THREAD,           NULL },
301 #endif
302   { "exit",                      OP_EXIT,                         "q" },
303   { "extract-keys",              OP_EXTRACT_KEYS,                 "\013" },     // <Ctrl-K>
304   { "flag-message",              OP_FLAG_MESSAGE,                 "F" },
305 #ifdef USE_NNTP
306   { "followup-message",          OP_FOLLOWUP,                     NULL },
307 #endif
308   { "forget-passphrase",         OP_FORGET_PASSPHRASE,            "\006" },     // <Ctrl-F>
309   { "forward-message",           OP_FORWARD_MESSAGE,              "f" },
310 #ifdef USE_NNTP
311   { "forward-to-group",          OP_FORWARD_TO_GROUP,             NULL },
312 #endif
313   { "group-chat-reply",          OP_GROUP_CHAT_REPLY,             NULL },
314   { "group-reply",               OP_GROUP_REPLY,                  "g" },
315   { "half-down",                 OP_HALF_DOWN,                    NULL },
316   { "half-up",                   OP_HALF_UP,                      NULL },
317   { "help",                      OP_HELP,                         "?" },
318 #ifdef USE_IMAP
319   { "imap-fetch-mail",           OP_MAIN_IMAP_FETCH,              NULL },
320   { "imap-logout-all",           OP_MAIN_IMAP_LOGOUT_ALL,         NULL },
321 #endif
322   { "jump",                      OP_JUMP,                         NULL },
323   { "link-threads",              OP_MAIN_LINK_THREADS,            "&" },
324   { "list-reply",                OP_LIST_REPLY,                   "L" },
325   { "list-subscribe",            OP_LIST_SUBSCRIBE,               NULL },
326   { "list-unsubscribe",          OP_LIST_UNSUBSCRIBE,             NULL },
327   { "mail",                      OP_MAIL,                         "m" },
328   { "mail-key",                  OP_MAIL_KEY,                     "\033k" },    // <Alt-k>
329   { "mailbox-list",              OP_MAILBOX_LIST,                 "." },
330   { "mark-as-new",               OP_TOGGLE_NEW,                   "N" },
331   { "modify-labels",             OP_MAIN_MODIFY_TAGS,             NULL }, // NOTE(sileht): kept for backward compatibility
332   { "modify-labels-then-hide",   OP_MAIN_MODIFY_TAGS_THEN_HIDE,   NULL }, // NOTE(sileht): kept for backward compatibility
333   { "modify-tags",               OP_MAIN_MODIFY_TAGS,             NULL },
334   { "modify-tags-then-hide",     OP_MAIN_MODIFY_TAGS_THEN_HIDE,   NULL },
335   { "next-entry",                OP_NEXT_ENTRY,                   "J" },
336   { "next-line",                 OP_NEXT_LINE,                    "\n" },       // <Enter>
337   { "next-line",                 OP_NEXT_LINE,                    "\r" },       // <Return>
338   { "next-new",                  OP_MAIN_NEXT_NEW,                NULL },
339   { "next-new-then-unread",      OP_MAIN_NEXT_NEW_THEN_UNREAD,    "\t" },       // <Tab>
340   { "next-page",                 OP_NEXT_PAGE,                    " " },        // <Space>
341   { "next-subthread",            OP_MAIN_NEXT_SUBTHREAD,          "\033n" },    // <Alt-n>
342   { "next-thread",               OP_MAIN_NEXT_THREAD,             "\016" },     // <Ctrl-N>
343   { "next-undeleted",            OP_MAIN_NEXT_UNDELETED,          "j" },
344   { "next-unread",               OP_MAIN_NEXT_UNREAD,             NULL },
345   { "next-unread-mailbox",       OP_MAIN_NEXT_UNREAD_MAILBOX,     NULL },
346   { "parent-message",            OP_MAIN_PARENT_MESSAGE,          "P" },
347   { "pipe-message",              OP_PIPE,                         "|" },
348 #ifdef USE_NNTP
349   { "post-message",              OP_POST,                         NULL },
350 #endif
351   { "previous-entry",            OP_PREV_ENTRY,                   "K" },
352   { "previous-line",             OP_PREV_LINE,                    NULL },
353   { "previous-new",              OP_MAIN_PREV_NEW,                NULL },
354   { "previous-new-then-unread",  OP_MAIN_PREV_NEW_THEN_UNREAD,    NULL },
355   { "previous-page",             OP_PREV_PAGE,                    "-" },
356   { "previous-subthread",        OP_MAIN_PREV_SUBTHREAD,          "\033p" },    // <Alt-p>
357   { "previous-thread",           OP_MAIN_PREV_THREAD,             "\020" },     // <Ctrl-P>
358   { "previous-undeleted",        OP_MAIN_PREV_UNDELETED,          "k" },
359   { "previous-unread",           OP_MAIN_PREV_UNREAD,             NULL },
360   { "print-message",             OP_PRINT,                        "p" },
361   { "purge-message",             OP_PURGE_MESSAGE,                NULL },
362   { "purge-thread",              OP_PURGE_THREAD,                 NULL },
363   { "quasi-delete",              OP_MAIN_QUASI_DELETE,            NULL },
364   { "quit",                      OP_QUIT,                         "Q" },
365   { "read-subthread",            OP_MAIN_READ_SUBTHREAD,          "\033r" },    // <Alt-r>
366   { "read-thread",               OP_MAIN_READ_THREAD,             "\022" },     // <Ctrl-R>
367   { "recall-message",            OP_RECALL_MESSAGE,               "R" },
368 #ifdef USE_NNTP
369   { "reconstruct-thread",        OP_RECONSTRUCT_THREAD,           NULL },
370 #endif
371   { "redraw-screen",             OP_REDRAW,                       "\014" },     // <Ctrl-L>
372   { "reply",                     OP_REPLY,                        "r" },
373   { "resend-message",            OP_RESEND,                       "\033e" },    // <Alt-e>
374   { "root-message",              OP_MAIN_ROOT_MESSAGE,            NULL },
375   { "save-message",              OP_SAVE,                         "s" },
376   { "search",                    OP_SEARCH,                       "/" },
377   { "search-next",               OP_SEARCH_NEXT,                  "n" },
378   { "search-opposite",           OP_SEARCH_OPPOSITE,              NULL },
379   { "search-reverse",            OP_SEARCH_REVERSE,               "\033/" },    // <Alt-/>
380   { "search-toggle",             OP_SEARCH_TOGGLE,                "\\" },       // <Backslash>
381   { "set-flag",                  OP_MAIN_SET_FLAG,                "w" },
382   { "shell-escape",              OP_SHELL_ESCAPE,                 "!" },
383   { "show-version",              OP_VERSION,                      "V" },
384 #ifdef USE_SIDEBAR
385   { "sidebar-first",             OP_SIDEBAR_FIRST,                NULL },
386   { "sidebar-last",              OP_SIDEBAR_LAST,                 NULL },
387   { "sidebar-next",              OP_SIDEBAR_NEXT,                 NULL },
388   { "sidebar-next-new",          OP_SIDEBAR_NEXT_NEW,             NULL },
389   { "sidebar-open",              OP_SIDEBAR_OPEN,                 NULL },
390   { "sidebar-page-down",         OP_SIDEBAR_PAGE_DOWN,            NULL },
391   { "sidebar-page-up",           OP_SIDEBAR_PAGE_UP,              NULL },
392   { "sidebar-prev",              OP_SIDEBAR_PREV,                 NULL },
393   { "sidebar-prev-new",          OP_SIDEBAR_PREV_NEW,             NULL },
394   { "sidebar-toggle-virtual",    OP_SIDEBAR_TOGGLE_VIRTUAL,       NULL },
395   { "sidebar-toggle-visible",    OP_SIDEBAR_TOGGLE_VISIBLE,       NULL },
396 #endif
397   { "skip-headers",              OP_PAGER_SKIP_HEADERS,           "H" },
398   { "skip-quoted",               OP_PAGER_SKIP_QUOTED,            "S" },
399   { "sort-mailbox",              OP_SORT,                         "o" },
400   { "sort-reverse",              OP_SORT_REVERSE,                 "O" },
401   { "sync-mailbox",              OP_MAIN_SYNC_FOLDER,             "$" },
402   { "tag-message",               OP_TAG,                          "t" },
403   { "toggle-quoted",             OP_PAGER_HIDE_QUOTED,            "T" },
404   { "toggle-write",              OP_TOGGLE_WRITE,                 "%" },
405   { "top",                       OP_PAGER_TOP,                    "^" },
406   { "undelete-message",          OP_UNDELETE,                     "u" },
407   { "undelete-subthread",        OP_UNDELETE_SUBTHREAD,           "\033u" },    // <Alt-u>
408   { "undelete-thread",           OP_UNDELETE_THREAD,              "\025" },     // <Ctrl-U>
409 #ifdef USE_NOTMUCH
410   { "vfolder-from-query",        OP_MAIN_VFOLDER_FROM_QUERY,      NULL },
411   { "vfolder-from-query-readonly", OP_MAIN_VFOLDER_FROM_QUERY_READONLY, NULL },
412 #endif
413   { "view-attachments",          OP_VIEW_ATTACHMENTS,             "v" },
414   { "view-raw-message",          OP_VIEW_RAW_MESSAGE,             NULL },
415   { "what-key",                  OP_WHAT_KEY,                     NULL },
416   /* This is deprecated.  Leave it last so it doesn't show up in the help. */
417   { "buffy-list",                OP_MAILBOX_LIST,                 NULL },
418   { NULL, 0, NULL },
419 };
420 
421 /**
422  * OpAttach - Key bindings for the attachment menu
423  */
424 const struct Binding OpAttach[] = { /* map: attachment */
425   { "bounce-message",        OP_BOUNCE_MESSAGE,              "b" },
426   { "check-traditional-pgp", OP_CHECK_TRADITIONAL,           "\033P" },         // <Alt-P>
427   { "collapse-parts",        OP_ATTACH_COLLAPSE,             "v" },
428   { "compose-to-sender",     OP_COMPOSE_TO_SENDER,           NULL },
429   { "delete-entry",          OP_DELETE,                      "d" },
430   { "display-toggle-weed",   OP_DISPLAY_HEADERS,             "h" },
431   { "edit-type",             OP_EDIT_TYPE,                   "\005" },          // <Ctrl-E>
432   { "extract-keys",          OP_EXTRACT_KEYS,                "\013" },          // <Ctrl-K>
433 #ifdef USE_NNTP
434   { "followup-message",      OP_FOLLOWUP,                    NULL },
435 #endif
436   { "forget-passphrase",     OP_FORGET_PASSPHRASE,           "\006" },          // <Ctrl-F>
437   { "forward-message",       OP_FORWARD_MESSAGE,             "f" },
438 #ifdef USE_NNTP
439   { "forward-to-group",      OP_FORWARD_TO_GROUP,            NULL },
440 #endif
441   { "group-chat-reply",      OP_GROUP_CHAT_REPLY,            NULL },
442   { "group-reply",           OP_GROUP_REPLY,                 "g" },
443   { "list-reply",            OP_LIST_REPLY,                  "L" },
444   { "list-subscribe",        OP_LIST_SUBSCRIBE,              NULL },
445   { "list-unsubscribe",      OP_LIST_UNSUBSCRIBE,            NULL },
446   { "pipe-entry",            OP_PIPE,                        "|" },
447   { "print-entry",           OP_PRINT,                       "p" },
448   { "reply",                 OP_REPLY,                       "r" },
449   { "resend-message",        OP_RESEND,                      "\033e" },         // <Alt-e>
450   { "save-entry",            OP_SAVE,                        "s" },
451   { "undelete-entry",        OP_UNDELETE,                    "u" },
452   { "view-attach",           OP_VIEW_ATTACH,                 "\n" },            // <Enter>
453   { "view-attach",           OP_VIEW_ATTACH,                 "\r" },            // <Return>
454   { "view-mailcap",          OP_ATTACH_VIEW_MAILCAP,         "m" },
455   { "view-pager",            OP_ATTACH_VIEW_PAGER,           NULL },
456   { "view-text",             OP_ATTACH_VIEW_TEXT,            "T" },
457   { NULL, 0, NULL },
458 };
459 
460 /**
461  * OpCompose - Key bindings for the compose menu
462  */
463 const struct Binding OpCompose[] = { /* map: compose */
464   { "attach-file",           OP_COMPOSE_ATTACH_FILE,         "a" },
465   { "attach-key",            OP_COMPOSE_ATTACH_KEY,          "\033k" },         // <Alt-k>
466   { "attach-message",        OP_COMPOSE_ATTACH_MESSAGE,      "A" },
467 #ifdef USE_NNTP
468   { "attach-news-message",   OP_COMPOSE_ATTACH_NEWS_MESSAGE, NULL },
469 #endif
470 #ifdef USE_AUTOCRYPT
471   { "autocrypt-menu",        OP_COMPOSE_AUTOCRYPT_MENU,      "o" },
472 #endif
473   { "copy-file",             OP_SAVE,                        "C" },
474   { "detach-file",           OP_DELETE,                      "D" },
475   { "display-toggle-weed",   OP_DISPLAY_HEADERS,             "h" },
476   { "edit-bcc",              OP_COMPOSE_EDIT_BCC,            "b" },
477   { "edit-cc",               OP_COMPOSE_EDIT_CC,             "c" },
478   { "edit-description",      OP_COMPOSE_EDIT_DESCRIPTION,    "d" },
479   { "edit-encoding",         OP_COMPOSE_EDIT_ENCODING,       "\005" },          // <Ctrl-E>
480   { "edit-fcc",              OP_COMPOSE_EDIT_FCC,            "f" },
481   { "edit-file",             OP_COMPOSE_EDIT_FILE,           "\030e" },         // <Alt-e>
482 #ifdef USE_NNTP
483   { "edit-followup-to",      OP_COMPOSE_EDIT_FOLLOWUP_TO,    NULL },
484 #endif
485   { "edit-from",             OP_COMPOSE_EDIT_FROM,           "\033f" },         // <Alt-f>
486   { "edit-headers",          OP_COMPOSE_EDIT_HEADERS,        "E" },
487   { "edit-language",         OP_COMPOSE_EDIT_LANGUAGE,       "\014" },          // <Ctrl-L>
488   { "edit-message",          OP_COMPOSE_EDIT_MESSAGE,        "e" },
489   { "edit-mime",             OP_COMPOSE_EDIT_MIME,           "m" },
490 #ifdef USE_NNTP
491   { "edit-newsgroups",       OP_COMPOSE_EDIT_NEWSGROUPS,     NULL },
492 #endif
493   { "edit-reply-to",         OP_COMPOSE_EDIT_REPLY_TO,       "r" },
494   { "edit-subject",          OP_COMPOSE_EDIT_SUBJECT,        "s" },
495   { "edit-to",               OP_COMPOSE_EDIT_TO,             "t" },
496   { "edit-type",             OP_EDIT_TYPE,                   "\024" },          // <Ctrl-T>
497 #ifdef USE_NNTP
498   { "edit-x-comment-to",     OP_COMPOSE_EDIT_X_COMMENT_TO,   NULL },
499 #endif
500   { "filter-entry",          OP_FILTER,                      "F" },
501   { "forget-passphrase",     OP_FORGET_PASSPHRASE,           "\006" },          // <Ctrl-F>
502   { "get-attachment",        OP_COMPOSE_GET_ATTACHMENT,      "G" },
503   { "group-alternatives",    OP_COMPOSE_GROUP_ALTS,          "&" },
504   { "group-multilingual",    OP_COMPOSE_GROUP_LINGUAL,       "^" },
505   { "ispell",                OP_COMPOSE_ISPELL,              "i" },
506 #ifdef MIXMASTER
507   { "mix",                   OP_COMPOSE_MIX,                 "M" },
508 #endif
509   { "move-down",             OP_COMPOSE_MOVE_DOWN,           "+" },
510   { "move-up",               OP_COMPOSE_MOVE_UP,             "-" },
511   { "new-mime",              OP_COMPOSE_NEW_MIME,            "n" },
512   { "pgp-menu",              OP_COMPOSE_PGP_MENU,            "p" },
513   { "pipe-entry",            OP_PIPE,                        "|" },
514   { "postpone-message",      OP_COMPOSE_POSTPONE_MESSAGE,    "P" },
515   { "print-entry",           OP_PRINT,                       "l" },
516   { "rename-attachment",     OP_COMPOSE_RENAME_ATTACHMENT,   "\017" },          // <Ctrl-O>
517   { "rename-file",           OP_COMPOSE_RENAME_FILE,         "R" },
518   { "send-message",          OP_COMPOSE_SEND_MESSAGE,        "y" },
519   { "smime-menu",            OP_COMPOSE_SMIME_MENU,          "S" },
520   { "toggle-disposition",    OP_COMPOSE_TOGGLE_DISPOSITION,  "\004" },          // <Ctrl-D>
521   { "toggle-recode",         OP_COMPOSE_TOGGLE_RECODE,       NULL },
522   { "toggle-unlink",         OP_COMPOSE_TOGGLE_UNLINK,       "u" },
523   { "update-encoding",       OP_COMPOSE_UPDATE_ENCODING,     "U" },
524   { "view-attach",           OP_VIEW_ATTACH,                 "\n" },            // <Enter>
525   { "view-attach",           OP_VIEW_ATTACH,                 "\r" },            // <Return>
526   { "write-fcc",             OP_COMPOSE_WRITE_MESSAGE,       "w" },
527   { NULL, 0, NULL },
528 };
529 
530 /**
531  * OpPost - Key bindings for the postpone menu
532  */
533 const struct Binding OpPost[] = { /* map: postpone */
534   { "delete-entry",          OP_DELETE,                      "d" },
535   { "undelete-entry",        OP_UNDELETE,                    "u" },
536   { NULL, 0, NULL },
537 };
538 
539 /**
540  * OpAlias - Key bindings for the alias menu
541  */
542 const struct Binding OpAlias[] = { /* map: alias */
543   { "delete-entry",          OP_DELETE,                      "d" },
544   { "limit",                 OP_MAIN_LIMIT,                  "l" },
545   { "sort-alias",            OP_SORT,                        "o" },
546   { "sort-alias-reverse",    OP_SORT_REVERSE,                "O" },
547   { "undelete-entry",        OP_UNDELETE,                    "u" },
548   { NULL, 0, NULL },
549 };
550 
551 /**
552  * OpBrowser - Key bindings for the file browser menu
553  */
554 const struct Binding OpBrowser[] = { /* map: browser */
555 #ifdef USE_NNTP
556   { "catchup",               OP_CATCHUP,                     NULL },
557 #endif
558   { "change-dir",            OP_CHANGE_DIRECTORY,            "c" },
559   { "check-new",             OP_CHECK_NEW,                   NULL },
560 #ifdef USE_IMAP
561   { "create-mailbox",        OP_CREATE_MAILBOX,              "C" },
562   { "delete-mailbox",        OP_DELETE_MAILBOX,              "d" },
563 #endif
564   { "descend-directory",     OP_DESCEND_DIRECTORY,           NULL },
565   { "display-filename",      OP_BROWSER_TELL,                "@" },
566   { "enter-mask",            OP_ENTER_MASK,                  "m" },
567   { "goto-folder",           OP_BROWSER_GOTO_FOLDER,         "=" },
568   { "goto-parent",           OP_GOTO_PARENT,                 "p" },
569   { "mailbox-list",          OP_MAILBOX_LIST,                "." },
570 #ifdef USE_NNTP
571   { "reload-active",         OP_LOAD_ACTIVE,                 NULL },
572 #endif
573 #ifdef USE_IMAP
574   { "rename-mailbox",        OP_RENAME_MAILBOX,              "r" },
575 #endif
576   { "select-new",            OP_BROWSER_NEW_FILE,            "N" },
577   { "sort",                  OP_SORT,                        "o" },
578   { "sort-reverse",          OP_SORT_REVERSE,                "O" },
579 #if defined(USE_IMAP) || defined(USE_NNTP)
580   { "subscribe",             OP_BROWSER_SUBSCRIBE,           "s" },
581 #endif
582 #ifdef USE_NNTP
583   { "subscribe-pattern",     OP_SUBSCRIBE_PATTERN,           NULL },
584 #endif
585   { "toggle-mailboxes",      OP_TOGGLE_MAILBOXES,            "\t" },            // <Tab>
586 #ifdef USE_IMAP
587   { "toggle-subscribed",     OP_BROWSER_TOGGLE_LSUB,         "T" },
588 #endif
589 #ifdef USE_NNTP
590   { "uncatchup",             OP_UNCATCHUP,                   NULL },
591 #endif
592 #if defined(USE_IMAP) || defined(USE_NNTP)
593   { "unsubscribe",           OP_BROWSER_UNSUBSCRIBE,         "u" },
594 #endif
595 #ifdef USE_NNTP
596   { "unsubscribe-pattern",   OP_UNSUBSCRIBE_PATTERN,         NULL },
597 #endif
598   { "view-file",             OP_BROWSER_VIEW_FILE,           " " },             // <Space>
599   /* This is deprecated.  Leave it last so it doesn't show up in the help. */
600   { "buffy-list",            OP_MAILBOX_LIST,                NULL },
601   { NULL, 0, NULL },
602 };
603 
604 /**
605  * OpQuery - Key bindings for the external query menu
606  */
607 const struct Binding OpQuery[] = { /* map: query */
608   { "create-alias",          OP_CREATE_ALIAS,                "a" },
609   { "limit",                 OP_MAIN_LIMIT,                  "l" },
610   { "mail",                  OP_MAIL,                        "m" },
611   { "query",                 OP_QUERY,                       "Q" },
612   { "query-append",          OP_QUERY_APPEND,                "A" },
613   { "sort",                  OP_SORT,                        "o" },
614   { "sort-reverse",          OP_SORT_REVERSE,                "O" },
615   { NULL, 0, NULL },
616 };
617 
618 /**
619  * OpEditor - Key bindings for the editor menu
620  */
621 const struct Binding OpEditor[] = { /* map: editor */
622   { "backspace",             OP_EDITOR_BACKSPACE,            "\010" },          // <Ctrl-H>
623   { "backward-char",         OP_EDITOR_BACKWARD_CHAR,        "\002" },          // <Ctrl-B>
624   { "backward-word",         OP_EDITOR_BACKWARD_WORD,        "\033b" },         // <Alt-b>
625   { "bol",                   OP_EDITOR_BOL,                  "\001" },          // <Ctrl-A>
626   { "capitalize-word",       OP_EDITOR_CAPITALIZE_WORD,      "\033c" },         // <Alt-c>
627   { "complete",              OP_EDITOR_COMPLETE,             "\t" },            // <Tab>
628   { "complete-query",        OP_EDITOR_COMPLETE_QUERY,       "\024" },          // <Ctrl-T>
629   { "delete-char",           OP_EDITOR_DELETE_CHAR,          "\004" },          // <Ctrl-D>
630   { "downcase-word",         OP_EDITOR_DOWNCASE_WORD,        "\033l" },         // <Alt-l>
631   { "eol",                   OP_EDITOR_EOL,                  "\005" },          // <Ctrl-E>
632   { "forward-char",          OP_EDITOR_FORWARD_CHAR,         "\006" },          // <Ctrl-F>
633   { "forward-word",          OP_EDITOR_FORWARD_WORD,         "\033f" },         // <Alt-f>
634   { "history-down",          OP_EDITOR_HISTORY_DOWN,         "\016" },          // <Ctrl-N>
635   { "history-search",        OP_EDITOR_HISTORY_SEARCH,       "\022" },          // <Ctrl-R>
636   { "history-up",            OP_EDITOR_HISTORY_UP,           "\020" },          // <Ctrl-P>
637   { "kill-eol",              OP_EDITOR_KILL_EOL,             "\013" },          // <Ctrl-K>
638   { "kill-eow",              OP_EDITOR_KILL_EOW,             "\033d" },         // <Alt-d>
639   { "kill-line",             OP_EDITOR_KILL_LINE,            "\025" },          // <Ctrl-U>
640   { "kill-word",             OP_EDITOR_KILL_WORD,            "\027" },          // <Ctrl-W>
641   { "mailbox-cycle",         OP_EDITOR_MAILBOX_CYCLE,        " " },             // <Space>
642   { "quote-char",            OP_EDITOR_QUOTE_CHAR,           "\026" },          // <Ctrl-V>
643   { "transpose-chars",       OP_EDITOR_TRANSPOSE_CHARS,      NULL },
644   { "upcase-word",           OP_EDITOR_UPCASE_WORD,          "\033u" },         // <Alt-u>
645   /* This is deprecated.  Leave it last so it doesn't show up in the help. */
646   { "buffy-cycle",           OP_EDITOR_MAILBOX_CYCLE,        NULL },
647   { NULL, 0, NULL },
648 };
649 
650 /**
651  * OpPgp - Key bindings for the pgp menu
652  */
653 const struct Binding OpPgp[] = { /* map: pgp */
654   { "verify-key",            OP_VERIFY_KEY,                  "c" },
655   { "view-name",             OP_VIEW_ID,                     "%" },
656   { NULL, 0, NULL },
657 };
658 
659 /**
660  * OpSmime - Key bindings for the smime menu
661  */
662 const struct Binding OpSmime[] = { /* map: smime */
663 #ifdef CRYPT_BACKEND_GPGME
664   { "verify-key",            OP_VERIFY_KEY,                  "c" },
665   { "view-name",             OP_VIEW_ID,                     "%" },
666 #endif
667   { NULL, 0, NULL },
668 };
669 
670 #ifdef MIXMASTER
671 /**
672  * OpMix - Key bindings for the mixmaster menu
673  */
674 const struct Binding OpMix[] = { /* map: mixmaster */
675   { "accept",                OP_MIX_USE,                     "\n" },            // <Enter>
676   { "accept",                OP_MIX_USE,                     "\r" },            // <Return>
677   { "append",                OP_MIX_APPEND,                  "a" },
678   { "chain-next",            OP_MIX_CHAIN_NEXT,              "<right>" },
679   { "chain-prev",            OP_MIX_CHAIN_PREV,              "<left>" },
680   { "delete",                OP_MIX_DELETE,                  "d" },
681   { "insert",                OP_MIX_INSERT,                  "i" },
682   { NULL, 0, NULL },
683 };
684 #endif /* MIXMASTER */
685 
686 #ifdef USE_AUTOCRYPT
687 /**
688  * OpAutocryptAcct - Key bindings for the autocrypt account
689  */
690 const struct Binding OpAutocryptAcct[] = { /* map: autocrypt account */
691   { "create-account",        OP_AUTOCRYPT_CREATE_ACCT,       "c" },
692   { "delete-account",        OP_AUTOCRYPT_DELETE_ACCT,       "D" },
693   { "toggle-active",         OP_AUTOCRYPT_TOGGLE_ACTIVE,     "a" },
694   { "toggle-prefer-encrypt", OP_AUTOCRYPT_TOGGLE_PREFER,     "p" },
695   { NULL, 0, NULL }
696 };
697 #endif
698 
699 // clang-format on
700