Commit 3cb4c031 authored by Frank Terbeck's avatar Frank Terbeck

_ta: Strip active session from list of candidates

parent 2fca0662
......@@ -30,10 +30,23 @@
function __ta-candidate () {
local expl
local curcontext="${curcontext}"
local -a reply cb
zstyle -a ":completion:${curcontext}:candidates" generate cb || return
local context=":completion:${curcontext}:candidates"
local -a reply cb active strips
zstyle -a "$context" generate cb || return
(( ${+functions[$cb]} )) || return
"${cb[@]}"
if [[ $ZSH_VERSION == <5->.* ]] &&
! zstyle -t "$context" tmux-is-ancient &&
zstyle -T "$context" strip-active-from-candidates
then
active=("${(f)$(command tmux list-sessions -F '#{session_name}')}")
reply=( ${(@)reply:|active} )
fi
if [[ $ZSH_VERSION == <5->.* ]] &&
zstyle -a "$context" remove strips
then
reply=( ${(@)reply:|strips} )
fi
_describe -t candidates 'candidates' reply "$@"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment