Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH v2] Correct completion of 'tmux new <TAB>'.
- X-seq: zsh-workers 41443
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH v2] Correct completion of 'tmux new <TAB>'.
- Date: Thu, 20 Jul 2017 21:06:07 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=UiSHcS h8ZUN/etV+IdOv21IpQNzdoRYWgeutt1fCwLI=; b=cGg6Vpu+3EzkKxuYIRCYDz 0+4Enbcw6wPss6aWsSP3wtbsspmPXLkBD2jPPRVTvL8guk7X00liX0ocD558eysJ hux1XzkXdKMTn0N+3jxKOu41TgA8mrd3ppxgmH1NsOGukf/Wysi9BUPTyj4fIFQM HXGmxP8aDzzwoyE9eq8Se/MiEE92QO577lvXId7v5ThVdbqqMLzggCClY2aoj/8u JLNp28TtmYis2MskooiIoqVGAF2hQxfD5t5fdOQ/ROST+SKPtHS5ZHTELusbAS7S sXcv5/oNN9clLsRe5GVOE1U8wPCNm1ux9yFYfW35UC/TGejEBGyRlk5GX5cL7Pgw ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=UiSHcS h8ZUN/etV+IdOv21IpQNzdoRYWgeutt1fCwLI=; b=sWHx1yEublrODc75G46nSw dbqtkQSb11oM+Ok+LL4sFFQqVj3XrtYFdcg2DRkbWIUUHlHR/Bml+VgLNMTai0VY NqEwxLN9trd9NFkuwb7QGeyfcb/+Eq2eJf68DbDe77A+tHh333Ki0Z4DgPBjnkN3 epeSDy2xGcbVJsgwthnruO9AuZhMggi0Ul7PDK6hzyt92JwWPdNZlobkW3lUv9bC ljWDMLBdKEH4tdoG41+YOMSu7Ot1BNExW4OCFy7bfiMMSa7LFWB87jqUYR4OuSLk ZMvCQlV34dVkYWF0yUauU7+Bl46HqQ+YXJPXVQc70ueDPgQxv1+kxNlH2YV69FLA ==
- 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
Reference: window_pane_spawn() in tmux 2.5.
Also, document _cmdstring and _precommand.
---
Re-sending with the new file included.
Cheers,
Daniel
Completion/Unix/Command/_tmux | 2 +-
Completion/Unix/Type/_cmdambivalent | 9 +++++++++
Doc/Zsh/compsys.yo | 16 ++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 Completion/Unix/Type/_cmdambivalent
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 0917da604..5f5bea922 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -526,7 +526,7 @@ _tmux-new-session() {
'-t+[specify target session]:session:__tmux-sessions' \
'-x[specify width]:width' \
'-y[specify height]:height' \
- '*:: :_cmdstring'
+ '*:: :_cmdambivalent'
}
_tmux-new-window() {
diff --git a/Completion/Unix/Type/_cmdambivalent b/Completion/Unix/Type/_cmdambivalent
new file mode 100644
index 000000000..04824e3a5
--- /dev/null
+++ b/Completion/Unix/Type/_cmdambivalent
@@ -0,0 +1,9 @@
+#autoload
+
+if (( CURRENT == 1 && ${#words} == 1 )); then
+ _cmdstring
+elif (( CURRENT == 1 )); then
+ _command_names -e
+else
+ _normal
+fi
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 47b07e85e..47c30843c 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -3014,6 +3014,17 @@ tt(-n), tt(-F), tt(-X) are passed to tt(compadd).
See tt(_description) for a description of var(tag) and var(descr).
)
+findex(_cmdambivalent)
+item(tt(_cmdambivalent))(
+Completes an external command.
+If there is a single argument, complete the command in a single word, like tt(_cmdstring);
+otherwise, complete the command in word-separated arguments, like tt(_precommand).
+)
+findex(_cmdstring)
+item(tt(_cmdstring))(
+Completes an external command as a single argument, as for
+tt(system+LPAR()...+RPAR()).
+)
findex(_complete)
item(tt(_complete))(
This completer generates all possible completions in a context-sensitive
@@ -3214,6 +3225,11 @@ tt(old-menu), see
ifzman(the section `Completion System Configuration' above)\
ifnzman(noderef(Completion System Configuration)).
)
+findex(_precommand)
+item(tt(_precommand))(
+Complete an external command in word-separated arguments, as for
+tt(exec) and tt(/usr/bin/env).
+)
findex(_prefix)
item(tt(_prefix))(
This completer can be used to try completion with the suffix (everything
Messages sorted by:
Reverse Date,
Date,
Thread,
Author