From a88a10e47db67a59f3b7ca10ba2c490029f01fac Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 10 Nov 2016 18:32:57 +0100 Subject: [PATCH] tmux: refactor install script + aliases.zsh --- shell/tmux/aliases.zsh | 8 +++++--- shell/tmux/install | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/shell/tmux/aliases.zsh b/shell/tmux/aliases.zsh index 262985e0..419ace54 100644 --- a/shell/tmux/aliases.zsh +++ b/shell/tmux/aliases.zsh @@ -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 diff --git a/shell/tmux/install b/shell/tmux/install index 64bfdcb0..912b600b 100755 --- a/shell/tmux/install +++ b/shell/tmux/install @@ -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"; }