mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
simplify logic
This commit is contained in:
parent
7832cb38f9
commit
d1aa3246cd
1 changed files with 15 additions and 33 deletions
|
|
@ -47,42 +47,24 @@ fi
|
||||||
: ${ZSH_TMUX_UNICODE:=false}
|
: ${ZSH_TMUX_UNICODE:=false}
|
||||||
|
|
||||||
# ALIASES
|
# ALIASES
|
||||||
alias tl='tmux list-sessions'
|
function _build_alias {
|
||||||
|
eval "function $1 {
|
||||||
|
if [[ \${1::1} == '-' ]]; then
|
||||||
|
tmux $2 \"\$@\"
|
||||||
|
else
|
||||||
|
tmux $2 $3 \"\$@\"
|
||||||
|
fi
|
||||||
|
}"
|
||||||
|
}
|
||||||
|
|
||||||
alias tksv='tmux kill-server'
|
alias tksv='tmux kill-server'
|
||||||
|
alias tl='tmux list-sessions'
|
||||||
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
|
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
|
||||||
|
|
||||||
function ts() {
|
_build_alias "ta" "attach" "-t"
|
||||||
if [[ $@ == -* ]]; then
|
_build_alias "tad" "attach -d" "-t"
|
||||||
tmux new-session $@
|
_build_alias "ts" "new-session" "-s"
|
||||||
else
|
_build_alias "tkss" "kill-session" "-t"
|
||||||
tmux new-session ${@:+-s}$@
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function tkss() {
|
|
||||||
if [[ $@ == -* ]]; then
|
|
||||||
tmux kill-session $@
|
|
||||||
else
|
|
||||||
tmux kill-session ${@:+-t}$@
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function ta() {
|
|
||||||
if [[ $@ == -* ]]; then
|
|
||||||
tmux attach-session $@
|
|
||||||
else
|
|
||||||
tmux attach-session ${@:+-t}$@
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function tad() {
|
|
||||||
if [[ $@ == -* ]]; then
|
|
||||||
tmux attach-session -d $@
|
|
||||||
else
|
|
||||||
tmux attach-session -d ${@:+-t}$@
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determine if the terminal supports 256 colors
|
# Determine if the terminal supports 256 colors
|
||||||
if [[ $terminfo[colors] == 256 ]]; then
|
if [[ $terminfo[colors] == 256 ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue