Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _ps1234: complete colors for %F{ and %K{
- X-seq: zsh-workers 35696
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: _ps1234: complete colors for %F{ and %K{
- Date: Mon, 6 Jul 2015 01:36:45 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=NPQ1mmTx9E1ZfKFYaQoq2xNBlBT7BdKer9gWTZ0xKT8=; b=fVVTz3l8XAQ/n2wBepGAvFe91FXyXaYdYS2dUybqJsh/9stoeJypew6pHcbGJnYL// hJyQTcxmwKtHozbDRn91xsscyt2BZiEe0hnWtEqAIvRJ3oJLZqNHkF9OvihgbT7xY852 BNHg1jOiW73HSZs/qLQ85mIS2nsRMPTJNFZQinH1Mm44jpbuFnkWnRll9n5+dEr6jXuf R+4wghS2RYfszFjN8OtpHmkP2p2Le2BrcRlYcM0GP5Ro6zsYhhkgygsb+XBMZHpSkrvo dw5WCnYfP4QZgwblLM9qEuFgjtMUVMdpKkvYT5UOh0iI4buYkfKwd2RiM8nQ1T224ZBW 8rtA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Super useful.
---
Completion/Unix/Type/_ps1234 | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/Completion/Unix/Type/_ps1234 b/Completion/Unix/Type/_ps1234
index 13c90b5..866349f 100644
--- a/Completion/Unix/Type/_ps1234
+++ b/Completion/Unix/Type/_ps1234
@@ -1,12 +1,10 @@
#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default-
local -a specs
-local expl paren
+local expl bs
-if [[ -n $compstate[quote] ]]; then
- paren='('
-else
- paren='\('
+if [[ -z $compstate[quote] ]]; then
+ bs='\'
fi
if [[ $PREFIX == *%(-|)<-># ]]; then
@@ -76,7 +74,7 @@ if [[ $PREFIX == *%(-|)<-># ]]; then
compset -P "*"
_describe -t prompt-format-specifier 'prompt format specifier' specs -S ''
_message -e prompt-format-specifier number
-elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
+elif [[ $PREFIX == *%$bs\((-|)<-># ]]; then
specs=(
'!:running with privileges'
'#:effective uid'
@@ -103,6 +101,25 @@ elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
compset -P "*"
_describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S ''
_message -e ternary-prompt-expression number
+elif [[ $PREFIX == *%[FK]$bs\{[0-9a-z]# ]]; then
+ specs=(
+ black
+ red
+ green
+ yellow
+ blue
+ magenta
+ cyan
+ white
+ default
+ )
+ compset -P "*{"
+ _describe -t ansi-color-name 'ansi color' specs -S $bs\}
+ if compset -P "<->"; then
+ _wanted ansi-color-number expl 'close brace' compadd -S '' \}
+ else
+ _message -e ansi-color-number "number between 0 and $(( $terminfo[colors] - 1 ))"
+ fi
else
_describe -t prompt-format-specifier 'prompt format specifier' '(%)' -S ''
_default "$@"
--
2.4.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author