Skip to content

Instantly share code, notes, and snippets.

@nathyong
Created October 24, 2014 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathyong/5d584df7faff052ef455 to your computer and use it in GitHub Desktop.
Save nathyong/5d584df7faff052ef455 to your computer and use it in GitHub Desktop.
save into ~/.oh-my-zsh/custom/plugins/tt/tt.plugin.zsh
# lovingly ripped off the _tmux completion module included in zsh
function __tmux-sessions() {
local expl
local -a sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
_describe -t sessions 'sessions' sessions "$@"
}
function _tmux-attach-session() {
[[ -n ${tmux_describe} ]] && print "Attach or switch to a session" && return
local -a args
args=(
':target session:__tmux-sessions'
)
_arguments ${args}
}
compdef _tmux-attach-session tt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment