Created
October 24, 2014 12:56
-
-
Save nathyong/5d584df7faff052ef455 to your computer and use it in GitHub Desktop.
save into ~/.oh-my-zsh/custom/plugins/tt/tt.plugin.zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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