mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +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}
|
||||
|
||||
# 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 tl='tmux list-sessions'
|
||||
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
|
||||
|
||||
function ts() {
|
||||
if [[ $@ == -* ]]; then
|
||||
tmux new-session $@
|
||||
else
|
||||
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
|
||||
}
|
||||
_build_alias "ta" "attach" "-t"
|
||||
_build_alias "tad" "attach -d" "-t"
|
||||
_build_alias "ts" "new-session" "-s"
|
||||
_build_alias "tkss" "kill-session" "-t"
|
||||
|
||||
# Determine if the terminal supports 256 colors
|
||||
if [[ $terminfo[colors] == 256 ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue