[neomutt-users] Macro to toggle a string value
rich at flatcap.org
Thu May 20 16:14:17 CEST 2021
On IRC today, someone asked:
How do I toggle the value of a string between two values?
Here's one solution:
set my_orig = "apple"
set my_alt = "banana"
macro index <F1> '<enter-command> set status_format="$my_orig" my_tmp="$my_orig" my_orig="$my_alt" my_alt="$my_tmp"; unset my_tmp<enter>'
Note: There's a space after the '<enter-command>'
This prevents the command being added to the history.
The macro uses some my_var's as temporary storage.
You can create any variable name you like, beginning 'my_'
You could even extend this macro by adding an 'echo' command to the end,
to display the current value.
macro index <F1> '<enter-command> ...; unset my_tmp; echo $status_format<enter>'
Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: not available
More information about the neomutt-users