configurable new windows and panes behavior (optionally retain current path)

This commit is contained in:
Gregory Pakosz
2014-12-17 20:47:06 +01:00
parent ecbb8d55f7
commit 1667cf9171
3 changed files with 37 additions and 8 deletions
+23 -8
View File
@@ -74,14 +74,6 @@ bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# split current window vertically, retain current path
bind '"' split-window -h -c "#{pane_current_path}"
bind _ split-window -h -c "#{pane_current_path}"
# split current window horizontally, retain current path
unbind %
bind % split-window -v -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
@@ -157,6 +149,7 @@ if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
# -- 8< ------------------------------------------------------------------------
run 'cut -c3- ~/.tmux.conf | sh -s apply_theme $tmux_conf_theme'
run 'cut -c3- ~/.tmux.conf | sh -s apply_configurable_bindings $tmux_conf_new_windows_retain_current_path $tmux_conf_new_panes_retain_current_path'
run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $name; done;'
@@ -366,4 +359,26 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# }
#
# apply_configurable_bindings() {
# windows_retain_current_path=${1:-false}
# if [ x"$windows_retain_current_path" = x"true" -o x"$windows_retain_current_path" = x"1" ] ; then
# tmux bind c new-window -c '#{pane_current_path}'
# else
# tmux bind c new-window
# fi
#
# panes_retain_current_path=${2:-true}
# if [ x"$panes_retain_current_path" = x"true" -o x"$panes_retain_current_path" = x"1" ] ; then
# tmux bind '"' split-window -h -c "#{pane_current_path}" \;\
# bind _ split-window -h -c "#{pane_current_path}" \;\
# bind % split-window -v -c "#{pane_current_path}" \;\
# bind - split-window -v -c "#{pane_current_path}"
# else
# tmux bind '"' split-window -h \;\
# bind _ split-window -h \;\
# bind % split-window -v \;\
# bind - split-window -v
# fi
# }
#
# $@