30 lines
935 B
Bash
30 lines
935 B
Bash
alias ta='tmux attach'
|
|
alias tl='tmux ls'
|
|
|
|
if [[ $TMUX ]]; then # From inside tmux
|
|
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
|
|
t() {
|
|
if (( $# > 0 )); then
|
|
tmux $@ || tmux attach -t main
|
|
else
|
|
tmux new -s main
|
|
fi
|
|
}
|
|
|
|
# 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
|