[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mutt-users
Subject:    Re: Toggling between two values of a string variable?
From:       Tom Ryder <tom () sanctum ! geek ! nz>
Date:       2020-06-28 2:17:34
Message-ID: 20200628021734.GB16508 () arjuna ! sanctum ! geek ! nz
[Download RAW message or body]

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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic