tmux: refactor install script + aliases.zsh
This commit is contained in:
parent
e6bdea030f
commit
a88a10e47d
|
@ -1,7 +1,7 @@
|
||||||
alias ta='tmux attach'
|
alias ta='tmux attach'
|
||||||
alias tl='tmux ls'
|
alias tl='tmux ls'
|
||||||
|
|
||||||
if [ -n "$TMUX" ]; then
|
if [[ $TMUX ]]; then # From inside tmux
|
||||||
alias t='tmux'
|
alias t='tmux'
|
||||||
alias tf='tmux find-window'
|
alias tf='tmux find-window'
|
||||||
# Detach all other clients to this session
|
# Detach all other clients to this session
|
||||||
|
@ -15,11 +15,13 @@ if [ -n "$TMUX" ]; then
|
||||||
tmux switch-client -t "$name"
|
tmux switch-client -t "$name"
|
||||||
tmux display-message "Session #S created"
|
tmux display-message "Session #S created"
|
||||||
}
|
}
|
||||||
else
|
else # From outside tmux
|
||||||
t() {
|
t() {
|
||||||
if (( $# > 0 )); then
|
if (( $# > 0 )); then
|
||||||
tmux $@ || tmux attach -t main
|
tmux $@ || tmux attach -t main
|
||||||
else tmux new -s main; fi
|
else
|
||||||
|
tmux new -s main
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start grouped session so I can be in two different windows in one session
|
# Start grouped session so I can be in two different windows in one session
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
case "$OSTYPE" in
|
case $OSTYPE in
|
||||||
darwin*)
|
darwin*)
|
||||||
brew install tmux
|
brew install tmux
|
||||||
;;
|
;;
|
||||||
linux*)
|
linux*)
|
||||||
if [ -f /etc/arch-release ]; then
|
if [ -f /etc/arch-release ]; then
|
||||||
sudo pacman --noconfirm -S tmux
|
sudo pacman --needed --noconfirm -S tmux
|
||||||
elif [ -f /etc/debian-version ]; then
|
elif [ -f /etc/debian-version ]; then
|
||||||
sudo apt-get install -y tmux
|
sudo apt-get install -y tmux
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
git-repo() { [[ -d $2 ]] || git clone "https://github.com/$1" "$2"; }
|
git-repo() { [[ -d $2 ]] || git clone "https://github.com/$1" "$2"; }
|
||||||
|
|
Loading…
Reference in a new issue