Toggling between two values of a string variable?
Tom Ryder
tom at sanctum.geek.nz
Sun Jun 28 02:17:34 UTC 2020
On Sat, Jun 27, 2020 at 08:48:15PM -0400, John Hawkinson wrote:
>Ideally I'd like to bind a key to toggle between two values of a string
>variable. There doesn't seem to be a good way to accomplish this -- is
>there a trick?
I've seen a few different ways to do this, but this is how I'm doing it
for toggling thread display, with a user variable (`$my_...`):
# Shortcut to toggle thread display
set sort = date
set my_sort_alt = threads
macro index \\t '\
<enter-command>set my_sort_cur = $sort<enter>\
<enter-command>set sort = $my_sort_alt<enter>\
<enter-command>set my_sort_alt = $my_sort_cur<enter>' \
"Toggle thread display"
So backslash-T toggles between the values "date" and "threads". I'm
aware of using dynamically-sourced files for this, per the ConfigTricks
section of the manual, but that approach is not my cup of tea.
--
Tom Ryder <https://sanctum.geek.nz/>
Maybe we can bring back the light.
More information about the Mutt-users
mailing list