Account for different tmux versions

tmux 1.9 implemented a behavior breaking change.  When splitting or creating new
panes or windows, the current path is no longer kept.  This is addressed by the
addition of the -c parameter to the new-window and split-window commands.
Unfortunately, 1.8 does not support the -c parameter.
This commit is contained in:
Andrew Tomaka 2015-03-17 17:09:18 -04:00
parent 705c00bc0f
commit 9588918a71
3 changed files with 8 additions and 6 deletions

2
.tmux.1-8.conf Normal file
View file

@ -0,0 +1,2 @@
bind s split-window -v # horizontal window split
bind v split-window -h # vertical window split

3
.tmux.1-9.conf Normal file
View file

@ -0,0 +1,3 @@
unbind c; bind c new-window -c #{pane_current_path}"
bind s split-window -v -c #{pane_current_path}" # horizontal window split
bind v split-window -h -c #{pane_current_path}" # vertical window split

View file

@ -39,13 +39,7 @@ bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind y run-shell "tmux show-buffer | xclip -sel clip -i"
# because the new tmux is inadequate
bind c new-window -c "#{pane_current_path}"
# be more like vim
bind s split-window -v -c "#{pane_current_path}" # horizontal window split
bind v split-window -h -c "#{pane_current_path}" # vertical window split
bind h select-pane -L # left pane
bind j select-pane -D # bottom pane
bind k select-pane -U # top pane
@ -65,3 +59,6 @@ set-window-option -g window-status-current-bg white
set-window-option -g window-status-current-fg black
set-option -g status-right '%d %b %Y @ %k:%M'
# because the new tmux is inadequate
if-shell 'test "$(tmux -V) = "tmux 1.8"' "source-file ~/.tmux.1-8.conf"
if-shell 'test "$(tmux -V) = "tmux 1.9"' "source-file ~/.tmux.1-9.conf"