diff rc/bashrc @ 501:072662ced8b8

Per-version tmux config.
author edogawaconan <me@myconan.net>
date Sun, 09 Mar 2014 14:11:47 +0900
parents 3979f3a55d0a
children 84ad2517ac90
line wrap: on
line diff
--- a/rc/bashrc	Tue Feb 25 16:44:02 2014 +0900
+++ b/rc/bashrc	Sun Mar 09 14:11:47 2014 +0900
@@ -15,6 +15,8 @@
 
 _org_path="${PATH}"
 
+_os="$(uname -s)"
+
 # Basic PATH
 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games"
 
@@ -85,7 +87,7 @@
 _grep="grep"
 _has_posix_grep=y
 
-case "$(uname -s)" in
+case "${_os}" in
   Linux)
     _has_gnu_ls=y
     _has_gnu_grep=y
@@ -233,6 +235,9 @@
   ;;
 esac
 
+# Priority PATHs. Always enable.
+PATH="${HOME}/bin:${HOME}/.ecos_bin:/opt/local/bin:/opt/local/sbin:${PATH}"
+
 if command -v vim > /dev/null 2>&1; then
   alias vi=vim
   export EDITOR=vim
@@ -263,7 +268,24 @@
   alias 0pp="gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=<-'"
 fi
 
-# Priority PATHs. Always enable.
-PATH="${HOME}/bin:${HOME}/.ecos_bin:/opt/local/bin:/opt/local/sbin:${PATH}"
+if command -v tmux > /dev/null 2>&1; then
+  case "${_os}" in
+  OpenBSD)
+    # FIXME: OpenBSD version check
+    _tmux_conf_ver=1.9
+  ;;
+  *)
+    case "$(tmux -V)" in
+    "tmux 1."[1-9][0-9]*|"tmux 1.9"*) _tmux_conf_ver=1.9;;
+    "tmux 1."[4-8]*) _tmux_conf_ver=1.4;;
+    *) _tmux_conf_ver=1.3;;
+    esac
+  ;;
+  esac
+  alias tmux="tmux -f '""${HOME}""/.tmux-""${_tmux_conf_ver}"".conf'"
+  unset _tmux_conf_ver
+fi
+
+unset _os
 
 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"