[neomutt-users] Top Tip [advanced]

Pietro Cerutti gahr at gahr.ch
Mon Apr 9 17:58:50 CEST 2018

On Apr  9 18 13:33, Richard Russon wrote:
>"$pager_index_lines" controls how much of the index is visible when
>you're reading an email.
>Recently a NeoMutt user asked:
>    "Can I toggle the variable between two values?"
>This triggered a bit of a discussion on IRC.
>NeoMutt doesn't support maths when setting variables.
>You can't:
>    set pager_index_lines = 50 - $pager_index_lines
>But Lua can!  Lua is a scripting language built into NeoMutt.
>Check to see if your NeoMutt supports lua:
>    neomutt -v | grep "+lua"
>We're going to use two commands:
>    mutt.get("pager_index_lines")
>    mutt.set("pager_index_lines", 50)
>and combine them into a macro:
>    macro index,pager <f3> ':lua mutt.set("pager_index_lines", 50 - mutt.get("pager_index_lines"))<enter><redraw-screen>'
>If you start with "$pager_index_lines = 10", then this macro would
>toggle it between 40 and 10 lines.
>What can *you* do with with some simple maths?

With [1] I can 

    macro index,pager <f3> ':set pager_index_lines=`dc -e "50 $pager_index_lines -p"`<enter><redraw-screen>'


[1] https://github.com/neomutt/neomutt/pull/1135

Pietro Cerutti
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 890 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20180409/12fcc2be/attachment.sig>

More information about the neomutt-users mailing list