1
0
Fork 0
mirror of synced 2024-11-17 23:15:35 -05:00

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

This commit is contained in:
Gregory Pakosz 2014-12-13 13:09:21 +01:00
parent ecbb8d55f7
commit 1667cf9171
3 changed files with 37 additions and 8 deletions

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
# }
#
# $@

View file

@ -8,6 +8,10 @@
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
#tmux_conf_battery='#(battery -t) '
# new windows and new panes optionally retain current path
#tmux_conf_new_windows_retain_current_path=false
#tmux_conf_new_panes_retain_current_path=true
# if you're running tmux within iTerm2
# - and tmux is 1.9 or 1.9a
# - and iTerm2 is configured to let option key act as +Esc

View file

@ -25,6 +25,7 @@ Features
- mouse mode toggle with `<prefix>m`
- automatic usage of `reattach-to-user-namespace` if available
- laptop battery status
- configurable new windows and panes behavior (optionally retain current path)
Installation
------------
@ -59,6 +60,15 @@ Edit your `~/.tmux.conf.local` file and uncomment the following lines:
See `~/.tmux.conf.local` for more details.
### Configuring new windows and new panes creation
Edit your `~/.tmux.conf.local` file and uncomment the following lines:
#tmux_conf_new_windows_retain_current_path=false
#tmux_conf_new_panes_retain_current_path=true
See `~/.tmux.conf.local` for more details.
### Accessing the Mac OSX clipboard from within tmux sessions
[Chris Johnsen created the `reattach-to-user-namespace`