* Can be zformat used to obtain multi column formatted text?
@ 2016-01-18 10:56 Sebastian Gniazdowski
2016-01-18 20:39 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2016-01-18 10:56 UTC (permalink / raw)
To: Zsh Users
Hello
I have list of words and ideally would like to display it in 2, 3, 4,
etc. columns depending on widths of the words. Less ideally, in 2
columns. How can this be accomplished with zformat?
Best regards,
Sebastian Gniazdowski
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Can be zformat used to obtain multi column formatted text?
2016-01-18 10:56 Can be zformat used to obtain multi column formatted text? Sebastian Gniazdowski
@ 2016-01-18 20:39 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2016-01-18 20:39 UTC (permalink / raw)
To: Zsh Users
On Jan 18, 11:56am, Sebastian Gniazdowski wrote:
} Subject: Can be zformat used to obtain multi column formatted text?
}
} I have list of words and ideally would like to display it in 2, 3, 4,
} etc. columns depending on widths of the words. Less ideally, in 2
} columns. How can this be accomplished with zformat?
It probably could be, but it's really meant for two things:
(1) support an external definition of the format string; for example,
to allow zstyle to define the format and the calling function to
supply the values for the %-expandos;
(2) lay out a two-column display with a middle column that is the same
in all rows, e.g., most often spaces or an "=" sign.
Even with (2) you have to build your own rows in the form COL1:COL2
before calling zformat -- it just replaces the ":" with the necessary
extra spaces to line up the two parts.
For more than two columns you're probably going to have better luck
using "print -C" where you can specify the number of columns. Using
"print -aC" is like the LIST_ROWS_FIRST setopt, but there isn't any
convenient way to emulate LIST_PACKED. You'd have to work out your
own column widths and use "printf".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-18 20:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 10:56 Can be zformat used to obtain multi column formatted text? Sebastian Gniazdowski
2016-01-18 20:39 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).