zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Can be zformat used to obtain multi column formatted text?
Date: Mon, 18 Jan 2016 12:39:52 -0800	[thread overview]
Message-ID: <160118123952.ZM7108@torch.brasslantern.com> (raw)
In-Reply-To: <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".


      reply	other threads:[~2016-01-18 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 10:56 Sebastian Gniazdowski
2016-01-18 20:39 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160118123952.ZM7108@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).