1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

41467: Correct completion of 'tmux new <TAB>'.

Reference: window_pane_spawn() in tmux 2.5.

Also, document _cmdstring and _precommand.
This commit is contained in:
Daniel Shahaf 2017-07-26 14:55:03 +00:00
parent a6f2755448
commit f183ed66c8
4 changed files with 43 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2017-07-28 Daniel Shahaf <d.s@daniel.shahaf.name>
* 41467: Completion/Unix/Command/_tmux,
Completion/Unix/Type/_cmdambivalent, Doc/Zsh/compsys.yo:
Correct completion of 'tmux new <TAB>'.
* 41471 (tweaked): Completion/Unix/Command/_subversion: _svn:
Complete propvals in 'propset'.

View file

@ -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() {

View file

@ -0,0 +1,17 @@
#autoload
if (( CURRENT == 1 && ${#words} == 1 )); then
# Heuristics to decide whether to complete for system() or for execl().
local space=' '
if (( ${${words[CURRENT]}[(I)$space]} )); then
_cmdstring
elif [[ ${${compstate[all_quotes]}[1]} == (\'|\") ]]; then
_cmdstring
else
_command_names -e
fi
elif (( CURRENT == 1 )); then
_command_names -e
else
_normal
fi

View file

@ -3014,6 +3014,22 @@ 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 the remaining positional arguments as an external command.
The external command and its arguments are completed as separate arguments
(in a manner appropriate for completing tt(/usr/bin/env))
if there are two or more remaining positional arguments on the command line,
and as a quoted command string (in the manner of tt(system+LPAR()...+RPAR())) otherwise.
See also tt(_cmdstring) and tt(_precommand).
This function takes no arguments.
)
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 +3230,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