[neomutt-users] Top Tip [advanced]

Richard Russon rich at flatcap.org
Mon Apr 9 14:33:08 CEST 2018


"$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?

Cheers,
    Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20180409/3863165f/attachment.sig>


More information about the neomutt-users mailing list