New tmux plugin. Cleaner and general. Read the header to see how to configure it to launch applications. If you want the old irc behaviour, add an alias: alias irc="t irc".

This commit is contained in:
Simon Gomizelj 2011-12-01 03:14:34 -05:00
commit 110465a320

View file

@ -1,37 +1,32 @@
# Enable autostarting of tmux with: # Enable autostarting of tmux with:
#
# zstyle :omz:plugins:tmux autostart on # zstyle :omz:plugins:tmux autostart on
# #
# Configure t command to autostart a command like
# this (example for "t irc"):
# zstyle :omz:plugins:cmd irc weechat-curses
#
if (( $+commands[tmux] )); then if (( $+commands[tmux] )); then
local state local state
# autoload tmux on start
zstyle -a :omz:plugins:tmux autostart state zstyle -a :omz:plugins:tmux autostart state
[[ $state == "on" && -z $TMUX ]] && exec tmux [[ $state == "on" && -z $TMUX ]] && exec tmux
# start an irc client in a tmux session t() {
if [[ -n $IRC ]]; then #load the command from config
irc() { zstyle -a :omz:plugins:tmux:cmd $1 cmd
if tmux has -t irc >/dev/null; then (( $+commands[$cmd] )) || return 127
[[ -n $TMUX ]] && tmux switch -t irc || tmux attach -t irc
else
TMUX="" tmux new -ds irc $IRC[1]
[[ -n $TMUX ]] && tmux switch -t irc || tmux attach -t irc
fi
}
fi
# start rtorrent in a tmux session # start the command
if [[ -n $RTORRENT ]]; then if ! tmux has -t $1 2>/dev/null; then
torrents() { TMUX= tmux new -ds $1 ${cmd-$2}
if tmux has -t torrents >/dev/null; then fi
[[ -n $TMUX ]] && tmux switch -t torrents || tmux attach -t torrents
else # switch or attach depending on if we're inside tmux
TMUX="" tmux new -ds torrents $RTORRENT[1] [[ -n $TMUX ]] && tmux switch -t $1 \
[[ -n $TMUX ]] && tmux switch -t torrents || tmux attach -t torrents || tmux attach -t $1
fi }
}
fi
else else
omz_log_mgs "notfound: plugin requires tmux" omz_log_mgs "tmux: plugin requires tmux"
fi fi