From: Bart Schaefer <firstname.lastname@example.org> To: zsugabubus <email@example.com> Cc: "firstname.lastname@example.org" <email@example.com> Subject: Re: Funky list-colors Date: Wed, 4 Dec 2019 15:27:17 -0800 Message-ID: <CAH+w=7Y_TDFMU_uEHtEbmAUiNRLs2Ek_NdbhUU9fAzc8ZxAYww@mail.gmail.com> (raw) In-Reply-To: <20191129203707.ipf4zjkkptg35lpa@localhost> On Fri, Nov 29, 2019 at 12:37 PM zsugabubus <firstname.lastname@example.org> wrote: > > On Fri, Nov 29, 2019 at 11:22:52AM -0800, Bart Schaefer wrote: > > What's the end goal here? > > To keep my message short, I wanted to receive a quick visual > feedback what kind of files I work with. That's where `LS_COLORS` came > into the view. However, if I'm only using 3-4 colors it looks like a > rainbow (more colors can be hardly distinguished and remembered). > [...] > So after my success story with colors, I started modifying `LS_COLORS` > to put prefixes before files. OK, so what you want here is not to fiddle with the way completion applies colors to the grid, but the way it populates the grid with file names. The first and most straightforward thing you might do is set the LIST_TYPES option (it should be set by default, but maybe it's become turned off). This puts an identifiying character at the end of the file name, e.g., character devices get a "%", block devices get a "#", directories a "/", symlinks an "@", etc. (Oddly I can't find a complete description of the identifying characters in the manual.) If you have this set and are not seeing these marks, it may be because your completion function is not using "compadd -f" to tell the internals to treat the names as files. If that's not sufficient (e.g., you want to differentiate among files that list_types treats as "plain") then I would presume you are doing this with a pattern match in the LS_COLORS setting. In that case you should look at the file-patterns zstyle, which in combination with the group-name and descriptions zstyles allows you to split the completion listing into sections. This can be a little tricky to get right, so feel free to post samples of your attempts here if you want help. If that's still not enough, then you'll want to create your own completion function to manage these files. "compadd -P prefix ..." will attach a prefix to each string added by that call to compadd, where that prefix is NOT treated as part of the file name, so if you can make separate calls to compadd for each variety of file you want to label, you can get exactly what you're looking for. For even more detail you can use something similar to: compadd -o -d labels_array -a filenames_array where there is one entry in $labels_array for each entry in $filenames_array. The completion system will arrange to build a grid of the labels and names so that each name is paired with the corresponding element from the labels. However, it does place the labels to the right of the names rather than to the left.
next prev parent reply index Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-11-29 12:21 zsugabubus 2019-11-29 16:06 ` Bart Schaefer 2019-11-29 17:23 ` zsugabubus 2019-11-29 19:22 ` Bart Schaefer 2019-11-29 20:37 ` zsugabubus 2019-12-04 23:27 ` Bart Schaefer [this message] 2019-12-05 7:44 ` Oliver Kiddle 2019-12-05 11:07 ` Sebastian Gniazdowski 2019-12-05 11:19 ` Roman Perepelitsa 2019-12-05 17:40 ` Oliver Kiddle 2019-12-07 20:58 ` zsugabubus 2019-12-07 21:42 ` Oliver Kiddle
Reply instructions: You may reply publically 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='CAH+w=7Y_TDFMU_uEHtEbmAUiNRLs2Ek_NdbhUU9fAzc8ZxAYww@mail.gmail.com' \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ /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
zsh-workers Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers Example config snippet for mirrors Newsgroup available over NNTP: nntp://inbox.vuxu.org/vuxu.archive.zsh.workers AGPL code for this site: git clone https://public-inbox.org/public-inbox.git