Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Can be zformat used to obtain multi column formatted text?
- X-seq: zsh-users 21165
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Can be zformat used to obtain multi column formatted text?
- Date: Mon, 18 Jan 2016 12:39:52 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=+Q8h9gS+trRmmvn+VVWYiLc0m7nXL4XHrCbTiIP8Ttg=; b=j4zfyCJ/SFV1L2WKEzXm9tx+iWfogjyebb9Sc9zeGB7yzCDK+ls/wxi9FkI16555FS dvuXLFGjIfBQ3DBZyxmnU6/y8uyLHGViLp7noxsQCkIgUGqcxor+sr5hll8QCyk4ZO5p Q8HfmFI241GD7PvL88YeIv9oAItoXztYP31gPU2jcntPqFup5CQVrSXt5mnjiC/fhy0/ LLEbewqYw2bT1s9mCqxgPRSIrfEAEqr6YKxou6fhXYPd1v2uc4MTBnPD0jyexDTukD+p ItVIx0jTlLmpRo1XoJSxW3hUD/s3FmAeU0oUB43gTadXEPKYsaKBi0n2PJSPpu4vCJCx WTSA==
- In-reply-to: <CAKc7PVB_6gC0QDsJ=hx0wXf=vdsm4kcczvh-QrDDPM02DB2G2g@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVB_6gC0QDsJ=hx0wXf=vdsm4kcczvh-QrDDPM02DB2G2g@mail.gmail.com>
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".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author