From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26984 invoked by alias); 18 Jan 2016 20:39:30 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21165 Received: (qmail 26107 invoked from network); 18 Jan 2016 20:39:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=+Q8h9gS+trRmmvn+VVWYiLc0m7nXL4XHrCbTiIP8Ttg=; b=fokDrBPpIjKWFBKAAWEPkGajj3EpFVGxgBIjUVsR/YTjw+viSA4T+XGDXkrizmDCZU J/OV9CTz3hE2htJ8LUzbjZcRETiduEaj01hNv3nKl1Z+VRGurClNWGlXRWizyvv1ndji i1+yqXGnuWDnfbUrhmBBKMSpxpCSPOoj7+f7or9FM3ZU1i5wI4AH+WxhgbtqZS0YAp9M bRbzav/RZ1BHoNXhEHg7T8Pti4aqCowTDzXhan6G5WMerxRTCfj/IVhxMC6f1iRW0zFN o/+iyznH0jACn2UJiXZbPLtaJ+77j8TTokUJTJ3Mx6qIxHKEqwZEfzPxBmNiVfK5TslN vfTA== X-Gm-Message-State: ALoCoQmhXzPmntUrpjgqr5trPX5CJtKDdhdOyqr+rpfnMQFzCztr+6nhSnTr3GKad18lu9By6sMKK5jpd+i5X8IS8A+MfNeAkw== X-Received: by 10.98.66.77 with SMTP id p74mr39529752pfa.43.1453149565815; Mon, 18 Jan 2016 12:39:25 -0800 (PST) From: Bart Schaefer Message-Id: <160118123952.ZM7108@torch.brasslantern.com> Date: Mon, 18 Jan 2016 12:39:52 -0800 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Can be zformat used to obtain multi column formatted text?" (Jan 18, 11:56am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Can be zformat used to obtain multi column formatted text? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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".