From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] _less: add --color (synonym for -D)
Date: Mon, 21 Feb 2022 22:26:31 +0900 [thread overview]
Message-ID: <D8F4DC2F-A15F-4E4A-85A1-7A4CA571E77F@kba.biglobe.ne.jp> (raw)
--color is a synonym for -D.
Also recognize - as a default color, so that
less -Du-<TAB>
offers background color.
While preparing this patch, I've noticed another minor problem of _less
but how to fix it is not obvious to me.
I will discuss it in another post.
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index ae912a633..0a72782ef 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -39,7 +39,7 @@ _arguments -S -s -A "[-+]*" \
'(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \
'!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \
'(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \
- '*-D+[set screen colors]: :->colors' \
+ '*'{-D+,--color=}'[set screen colors]: :->colors' \
'(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \
'(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \
'(-f --force)'{-f,--force}'[force opening of non-regular files]' \
@@ -104,7 +104,7 @@ if [[ -n "$state" ]]; then
if compset -P 1 \?; then
[[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )'
suf=( -S '' )
- compset -P 1 '([a-zA-Z]|*.)' && fgbg=background && suf=()
+ compset -P 1 '([-a-zA-Z]|*.)' && fgbg=background && suf=()
basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow )
_describe -t colors "$fgbg color" \
"( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0
reply other threads:[~2022-02-21 13:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=D8F4DC2F-A15F-4E4A-85A1-7A4CA571E77F@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@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).