Skip to content
Browse files

30368: _tmux: complete arguments to unambiguous partial subcommands

  • Loading branch information...
1 parent 9db1831 commit 511fc6e367e886fda47569acafc8f82ba1265546 @Mikachu Mikachu committed
Showing with 17 additions and 1 deletion.
  1. +5 −1 ChangeLog
  2. +12 −0 Completion/Unix/Command/_tmux
View
6 ChangeLog
@@ -6,6 +6,10 @@
* 30372: Completion/Unix/Command/_tmux: Redirect error output
produced when no tmux server is running to /dev/null.
+ * 30368: Completion/Unix/Command/_tmux: Make completion work
+ when an unambiguous prefix for a known subcommand is given, as
+ in 'tmux att -<tab>'.
+
2012-03-23 Simon Ruderich <simon@ruderich.org>
* 30366: Misc/vcs_info-examples: Fix outdated quilt examples.
@@ -16116,5 +16120,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5613 $
+* $Revision: 1.5614 $
*****************************************************
View
12 Completion/Unix/Command/_tmux
@@ -1528,6 +1528,18 @@ function _tmux() {
if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
fi
+ if ! (( ${+functions[_tmux-$tmuxcommand]} )); then
+ local low high
+ low=$_tmux_commands[(i)$tmuxcommand*]
+ high=$_tmux_commands[(I)$tmuxcommand*]
+ if (( low == high )); then
+ tmuxcommand=${_tmux_commands[low]%%:*}
+ elif (( low < high )); then
+ _message -e "Ambiguous command $tmuxcommand"
+ else
+ _message -e "Subcommand $tmuxcommand not known"
+ fi
+ fi
curcontext="${curcontext%:*:*}:tmux-${tmuxcommand}:"
_call_function ret _tmux-${tmuxcommand}
fi

0 comments on commit 511fc6e

Please sign in to comment.
Something went wrong with that request. Please try again.