tmux: refactor install script + aliases.zsh

This commit is contained in:
Henrik Lissner 2016-11-10 18:32:57 +01:00
parent e6bdea030f
commit a88a10e47d
2 changed files with 9 additions and 6 deletions

View file

@ -1,7 +1,7 @@
alias ta='tmux attach'
alias tl='tmux ls'
if [ -n "$TMUX" ]; then
if [[ $TMUX ]]; then # From inside tmux
alias t='tmux'
alias tf='tmux find-window'
# Detach all other clients to this session
@ -15,11 +15,13 @@ if [ -n "$TMUX" ]; then
tmux switch-client -t "$name"
tmux display-message "Session #S created"
}
else
else # From outside tmux
t() {
if (( $# > 0 )); then
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

View file

@ -1,15 +1,16 @@
#!/bin/bash
#!/usr/bin/env bash
case "$OSTYPE" in
case $OSTYPE in
darwin*)
brew install tmux
;;
linux*)
if [ -f /etc/arch-release ]; then
sudo pacman --noconfirm -S tmux
sudo pacman --needed --noconfirm -S tmux
elif [ -f /etc/debian-version ]; then
sudo apt-get install -y tmux
fi
;;
esac
git-repo() { [[ -d $2 ]] || git clone "https://github.com/$1" "$2"; }