1
0
Fork 0
mirror of synced 2024-11-03 01:08:59 -04:00

added support for explicit 'split-window' with ssh reconnect, closes #164

tmux only allows binding to existing commands, so when the command given to
'split-window' is 'ssh' and only 'ssh', the binding is converted to a call to
_split_window_ssh()
This commit is contained in:
Gregory Pakosz 2020-09-06 18:23:12 +02:00
parent 17b9a7a59a
commit 8976729f4f

View file

@ -668,7 +668,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# esac # esac
# } # }
# #
# _split_window() { # _split_window_ssh() {
# tty=${1:-$(tmux display -p '#{pane_tty}')} # tty=${1:-$(tmux display -p '#{pane_tty}')}
# shift # shift
# #
@ -690,6 +690,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# esac # esac
# } # }
# #
# _split_window() {
# _split_window_ssh "$@"
# }
#
# _apply_overrides() { # _apply_overrides() {
# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false} # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false}
# if _is_enabled "$tmux_conf_theme_24b_colour"; then # if _is_enabled "$tmux_conf_theme_24b_colour"; then
@ -731,6 +735,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# "$cfg" # "$cfg"
# fi # fi
# #
# perl -p -i -e "
# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\
# "$cfg"
#
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
# if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
@ -743,9 +751,9 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# ; # ;
# s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g
# ; # ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\1'/g if /\bdisplay-menu\b/ # s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/
# ; # ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \"#\{pane_current_path\}\"\1'/g" \ # s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \
# "$cfg" # "$cfg"
# fi # fi
# #