Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Add sketchy parameter flags completion
- X-seq: zsh-workers 29383
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: Add sketchy parameter flags completion
- Date: Fri, 27 May 2011 03:20:04 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer; bh=Di/B2zU3J8FdvW4g2o5BtNCNsQC3gEBsM9uYw3U+w9w=; b=Lp1rgR+3NcATv3Si6ZL0I4ayoxLHTPEx4FX9k9Ig7OEd1RbO7liljNxqJOEkQrLagG JSJ1TPMjHBZowRpki9d9A3areDCLUqswf8p16JArIBZuUPLRr35xADk88WvYjUhBz1LU s0taG3GjiZpVSmVUmT3Cixw8rgkJAtai8FyDw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=bLcRCX2zXTLfHI+d7qZHVknDBkpsIJJbZqy9dJ1aq1rkl+57wSHfjIK+zwsClEc4uV RE6bgJNv5maJKpZu+2tRsBSBQ98mffWagEf0hNQ5RzCCe56Ef9NdZZbG6TM/QLI6eSnG PvFPi0WzmCrtmOMA0v2ypBxLdU/Ns+0gLvHzc=
- 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
I don't intend to commit this, but I thought I'd post it anyway, I
find it pretty useful. It needs some more special handling stuff like
_glob_quals has.
---
Completion/Unix/Type/_path_files | 5 +++
Completion/Zsh/Type/_parameter_flags | 55 ++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)
create mode 100644 Completion/Zsh/Type/_parameter_flags
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 1c272ba..d3bae03 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -2,6 +2,11 @@
local -a match mbegin mend
+if [[ $PREFIX = *\$\{\([^\)]# ]]; then
+ _parameter_flags
+ return
+fi
+
# Look for glob qualifiers. Do this first: if we're really
# in a glob qualifier, we don't actually want to expand
# the earlier part of the path. We can't expand inside
diff --git a/Completion/Zsh/Type/_parameter_flags b/Completion/Zsh/Type/_parameter_flags
new file mode 100644
index 0000000..24d00b4
--- /dev/null
+++ b/Completion/Zsh/Type/_parameter_flags
@@ -0,0 +1,55 @@
+#autoload
+
+local -a flags
+
+flags=(
+ "#:show result as character (printf %c)"
+ "%:expand % escapes as in prompts"
+ "@:separate array elements when double quoted"
+ "A:create array parameter, associative when repeated"
+ "a:sort in array index order"
+ "c:with \${#name} count total characters in array with spaces"
+ "C:capitalize words"
+ "D:reverse ~ substitution"
+ "e:perform expansion on result"
+ "f:split expansion on newlines, ps:\\n:"
+ "F:join array with newlines, pj:\\n:"
+ "i:sort case-insensitively"
+ "k:substitute keys or indices instead of values"
+ "L:lowercase words"
+ "n:numeric sort"
+ "o:sort in ascending order"
+ "O:sort in descending order"
+ "P:interpret expansion as parameter name"
+ "q:quote expansion, repeat for variations"
+ "q-:minimal quoting"
+ "Q:remove one level of quoting"
+ "t:describe parameter"
+ "u:expand only unique words"
+ "U:uppercase words"
+ "v:with k, substitute both key and value, otherwise force value expansion"
+ "V:make special characters readable"
+ "w:with \${#name} count words, use s to set delimiter"
+ "W:like w but count also empty words"
+ "X:report errors"
+ "z:split into words by shell parsing"
+ "0:split expansion on null bytes, ps:\\0:"
+ "p:recognize escape sequences in arguments to further flags"
+ "~:treat string arguments to further flags as patterns"
+ "j:join words of arrays using separator"
+ "l:pad words on left, l:expr:[:string1:][:string2:]"
+ "m:report width rather than length of strings"
+ "mm:report number of visible characters"
+ "r:pad words on right, r:expr:[:string1:][:string2:]"
+ "s:field split into array using separator"
+ "S:non-greedy matching with / or //, search substrings with # or %"
+ "I:search the :expr:th match"
+ "B:index of the beginning of match"
+ "E:index of the end of match"
+ "M:matched portion"
+ "N:length of match"
+ "R:unmatched portion"
+ )
+
+compset -P '*'
+_describe -t paramflags "parameter flag" flags -Q -S ''
--
1.7.4-rc1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author