long complex format variables

12 views
Skip to first unread message

Michael Grant

unread,
Jun 4, 2025, 5:56:54 PMJun 4
to tmux-...@googlegroups.com


I've been working on the status line formats recently.  These variables, in the C code are nicely indented.  Is there some way to deal with format variables in a friendly way in the config file and in the shell passing as an arg to `tmux set`?

I didn't see any way to pretty-print a format variable so I wrote something in C.  It could be added as an option to `show-option`, but it would be useful if the output of such a formatted variable was able to be directly read back in.  I did not find any easy, friendly way.  I was wondering other people do.  Like modifying a popup menu is really tedious all in one single line.

If there is truly no way at this moment, what about making an option to `show-option` which pretty prints with leading tabs and newlines, and an option to `set-option` which ignores leading tabs and trailing newlines?  Would this be useful?  I will happily drop this in a PR.

Michael Grant

Nicholas Marriott

unread,
Jun 5, 2025, 11:10:12 AMJun 5
to Michael Grant, tmux-users
Yes. Part of the plan for keeping commands as commands rather than strings was to make eg bind-key be able to pretty print. Being able to make formats pretty printed would be a nice step. Might be worth making each option have a flag to say whether it holds a format or not, so show-option could do it automatically? (would probably still want a flag to show w/o for parsing)

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/CD5149BD-5D02-4E35-8C9D-36C980D7DABB%40gmail.com.

Nicholas Marriott

unread,
Jun 5, 2025, 11:11:34 AMJun 5
to Michael Grant, tmux-users
I'm not sure about set-option, for that it might be better to have a generic way to split strings in the config file. Isn't there a way to do it already? I can't remember if \ for line continuation works inside strings.
Reply all
Reply to author
Forward
0 new messages