helm/shell/tmux/aliases.zsh

30 lines
935 B
Bash
Raw Normal View History

2016-10-19 07:56:37 -07:00
alias ta='tmux attach'
alias tl='tmux ls'
if [[ $TMUX ]]; then # From inside tmux
2016-10-19 07:56:37 -07:00
alias t='tmux'
alias tf='tmux find-window'
# Detach all other clients to this session
alias mine='tmux detach -a'
# Send command to other tmux window
tt() { tmux send-keys -t .+ C-u && tmux set-buffer "$*" && tmux paste-buffer -t .+ && tmux send-keys -t .+ Enter; }
# Create new session (from inside one)
tn() {
local name="${1:-`basename $PWD`}"
TMUX= tmux new-session -d -s "$name"
tmux switch-client -t "$name"
tmux display-message "Session #S created"
}
else # From outside tmux
2016-10-19 07:56:37 -07:00
t() {
if (( $# > 0 )); then
tmux $@ || tmux attach -t main
else
tmux new -s main
fi
2016-10-19 07:56:37 -07:00
}
# Start grouped session so I can be in two different windows in one session
tdup() { tmux new-session -t "${1:-`tmux display-message -p '#S'`}"; }
fi