changeset 501:072662ced8b8

Per-version tmux config.
author edogawaconan <me@myconan.net>
date Sun, 09 Mar 2014 14:11:47 +0900
parents faf6bc91feb5
children 535c202bb3db
files rc/bashrc rc/cshrc rc/tmux-1.3.conf rc/tmux-1.4.conf rc/tmux-1.9.conf rc/tmux.conf setup
diffstat 7 files changed, 102 insertions(+), 29 deletions(-) [+]
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"
--- a/rc/cshrc	Tue Feb 25 16:44:02 2014 +0900
+++ b/rc/cshrc	Sun Mar 09 14:11:47 2014 +0900
@@ -49,6 +49,7 @@
 alias ll ls -lA
 alias ls ls -F
 alias rm rm -i
+alias tmux tmux -f ~/.tmux-1.3.conf
 
 if ($?prompt) then
   set gnuls_opts="--color=auto --group-directories-first -F"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/tmux-1.3.conf	Sun Mar 09 14:11:47 2014 +0900
@@ -0,0 +1,22 @@
+set -g terminal-overrides '*:acsc@'
+
+set -g repeat-time 0
+set -g status-bg cyan
+set -g status-fg white
+
+set -g status-left '#[bg=white,fg=black] #S #[default] '
+
+set -g status-right '#[bg=white,fg=black] #H #[bg=black,fg=white] %b-%d %H:%M '
+
+set -g status-utf8 on
+setw -g utf8 on
+
+set -g pane-active-border-fg cyan
+
+set -g set-titles on
+set -g set-titles-string '[#S] #I:#W #T'
+
+setw -g window-status-attr bold
+setw -g window-status-current-attr bold
+setw -g window-status-current-bg black
+setw -g window-status-current-fg white
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/tmux-1.4.conf	Sun Mar 09 14:11:47 2014 +0900
@@ -0,0 +1,20 @@
+set -g repeat-time 0
+set -g status-bg cyan
+set -g status-fg white
+
+set -g status-left '#[bg=white,fg=black] #S #[default] '
+
+set -g status-right '#[bg=white,fg=black] #H #[bg=black,fg=white] %b-%d %H:%M '
+
+set -g status-utf8 on
+setw -g utf8 on
+
+set -g pane-active-border-fg cyan
+
+set -g set-titles on
+set -g set-titles-string '[#S] #I:#W #T'
+
+setw -g window-status-attr bold
+setw -g window-status-current-attr bold
+setw -g window-status-current-bg black
+setw -g window-status-current-fg white
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/tmux-1.9.conf	Sun Mar 09 14:11:47 2014 +0900
@@ -0,0 +1,24 @@
+set -g repeat-time 0
+set -g status-bg cyan
+set -g status-fg white
+
+set -g status-left '#[bg=white,fg=black] #S #[default] '
+
+set -g status-right '#[bg=white,fg=black] #H #[bg=black,fg=white] %b-%d %H:%M '
+
+set -g status-utf8 on
+setw -g utf8 on
+
+set -g pane-active-border-fg cyan
+
+set -g set-titles on
+set -g set-titles-string '[#S] #I:#W #T'
+
+setw -g window-status-attr bold
+setw -g window-status-current-attr bold
+setw -g window-status-current-bg black
+setw -g window-status-current-fg white
+
+bind-key c new-window -c "#{pane_current_path}"
+bind-key '"' split-window -c "#{pane_current_path}"
+bind-key % split-window -h -c "#{pane_current_path}"
--- a/rc/tmux.conf	Tue Feb 25 16:44:02 2014 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-##PRE-1.4
-#set -g terminal-overrides '*:acsc@'
-
-##UNDEFINED. NEED CHECK WHICH VERSION
-set -g repeat-time 0
-set -g status-bg cyan
-set -g status-fg white
-
-set -g status-left '#[bg=white,fg=black] #S #[default] '
-
-set -g status-right '#[bg=white,fg=black] #H #[bg=black,fg=white] %b-%d %H:%M '
-
-set -g status-utf8 on
-setw -g utf8 on
-
-set -g pane-active-border-fg cyan
-
-set -g set-titles on
-set -g set-titles-string '[#S] #I:#W #T'
-
-setw -g window-status-attr bold
-setw -g window-status-current-attr bold
-setw -g window-status-current-bg black
-setw -g window-status-current-fg white
-#setw -g window-status-current-format '#I:#W'
--- a/setup	Tue Feb 25 16:44:02 2014 +0900
+++ b/setup	Sun Mar 09 14:11:47 2014 +0900
@@ -121,6 +121,15 @@
   _echo "Ensured existence of ${@}"
 }
 
+_tmux() {
+  # Remove old tmux config.
+  _rc uninstall "tmux.conf" ".tmux.conf"
+  for tmux_conf in "${rcdir}/tmux-"*.conf; do
+    tmux_conf_file="${tmux_conf##*/}"
+    _rc "${1}" "${tmux_conf_file}" ".${tmux_conf_file}"
+  done
+}
+
 _help() {
   cat <<EOF
 Usage: ${0} [install|uninstall]
@@ -141,7 +150,7 @@
     _rc "${1}" "hgignore_global" ".hgignore_global"
     _touch "${HOME}/.hgignore_global.local"
     _rc "${1}" "inputrc" ".inputrc"
-    _rc "${1}" "tmux.conf" ".tmux.conf"
+    _tmux "${1}"
     _rc "${1}" "vim-solarized" ".vim/colors/solarized.vim"
     _rc "${1}" "vim-syntax-coffee" ".vim/syntax/coffee.vim"
     _rc "${1}" "vim-syntax-json" ".vim/syntax/json.vim"