added a way to selectively disable binding manipulation, closes #514
you can set the following variables to 'disabled': - tmux_conf_new_window_retain_current_path - tmux_conf_new_pane_retain_current_path - tmux_conf_new_pane_reconnect_ssh - tmux_conf_new_session_prompt - tmux_conf_copy_to_os_clipboard
This commit is contained in:
parent
b69ae7c1a4
commit
e865a8a1c1
2 changed files with 49 additions and 28 deletions
70
.tmux.conf
70
.tmux.conf
|
@ -196,8 +196,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
#
|
#
|
||||||
# _tmux_version=$(tmux -V | awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}')
|
# _tmux_version=$(tmux -V | awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}')
|
||||||
#
|
#
|
||||||
|
# _is_true() {
|
||||||
|
# [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]
|
||||||
|
# }
|
||||||
|
#
|
||||||
# _is_enabled() {
|
# _is_enabled() {
|
||||||
# [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ]
|
# [ x"$1" = x"enabled" ]
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# _is_disabled() {
|
||||||
|
# [ x"$1" = x"disabled" ]
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# _circled() {
|
# _circled() {
|
||||||
|
@ -580,7 +588,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }')
|
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }')
|
||||||
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }')
|
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }')
|
||||||
# else
|
# else
|
||||||
# if ! _is_enabled "$ssh_only"; then
|
# if ! _is_true "$ssh_only"; then
|
||||||
# username=${pane_info#*:}
|
# username=${pane_info#*:}
|
||||||
# username=${username%%:*}
|
# username=${username%%:*}
|
||||||
# fi
|
# fi
|
||||||
|
@ -607,7 +615,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# # shellcheck disable=SC2086
|
# # shellcheck disable=SC2086
|
||||||
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }')
|
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }')
|
||||||
#
|
#
|
||||||
# if ! _is_enabled "$full"; then
|
# if ! _is_true "$full"; then
|
||||||
# case "$hostname" in
|
# case "$hostname" in
|
||||||
# *[a-z-].*)
|
# *[a-z-].*)
|
||||||
# hostname=${hostname%%.*}
|
# hostname=${hostname%%.*}
|
||||||
|
@ -618,7 +626,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# esac
|
# esac
|
||||||
# fi
|
# fi
|
||||||
# else
|
# else
|
||||||
# if ! _is_enabled "$ssh_only"; then
|
# if ! _is_true "$ssh_only"; then
|
||||||
# hostname="$h_or_H"
|
# hostname="$h_or_H"
|
||||||
# fi
|
# fi
|
||||||
# fi
|
# fi
|
||||||
|
@ -723,7 +731,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# if [ x"$apply_overrides" = x"" ] && [ x"$(tput colors)" = x"16777216" ]; then
|
# if [ x"$apply_overrides" = x"" ] && [ x"$(tput colors)" = x"16777216" ]; then
|
||||||
# apply_overrides=true
|
# apply_overrides=true
|
||||||
# fi
|
# fi
|
||||||
# elif _is_enabled "$tmux_conf_24b_colour"; then
|
# elif _is_true "$tmux_conf_24b_colour"; then
|
||||||
# apply_overrides=true
|
# apply_overrides=true
|
||||||
# fi
|
# fi
|
||||||
# if [ x"$apply_overrides" = x"true" ]; then
|
# if [ x"$apply_overrides" = x"true" ]; then
|
||||||
|
@ -746,36 +754,44 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# # output of list-keys can be truncated
|
# # output of list-keys can be truncated
|
||||||
# perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg"
|
# perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg"
|
||||||
#
|
#
|
||||||
# perl -p -i -e "
|
|
||||||
# s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g
|
|
||||||
# ;
|
|
||||||
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{b:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_pid} #{b:pane_tty}\2\5\1/g
|
|
||||||
# ;
|
|
||||||
# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{b:pane_tty\}\3)(.*?)\2/split-window\4/g
|
|
||||||
# ;
|
|
||||||
# s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \
|
|
||||||
# "$cfg"
|
|
||||||
#
|
|
||||||
# tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
|
# tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
|
||||||
# if _is_enabled "$tmux_conf_new_window_retain_current_path"; then
|
# if ! _is_disabled "$tmux_conf_new_window_retain_current_path"; then
|
||||||
# perl -p -i -e "
|
# perl -p -i -e "
|
||||||
# s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
|
# s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" \
|
||||||
# ;
|
|
||||||
# s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \
|
|
||||||
# "$cfg"
|
# "$cfg"
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
|
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
|
||||||
|
# if ! _is_disabled "$tmux_conf_new_pane_retain_current_path"; then
|
||||||
|
# perl -p -i -e "
|
||||||
|
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{b:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_pid} #{b:pane_tty}\2\5\1/g
|
||||||
|
# ;
|
||||||
|
# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{b:pane_tty\}\3)(.*?)\2/split-window\4/g
|
||||||
|
# ;
|
||||||
|
# s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \
|
||||||
|
# "$cfg"
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if ! _is_disabled "$tmux_conf_new_window_retain_current_path"; then
|
||||||
|
# if _is_true "$tmux_conf_new_window_retain_current_path"; then
|
||||||
|
# perl -p -i -e "
|
||||||
|
# s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
|
||||||
|
# ;
|
||||||
|
# s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \
|
||||||
|
# "$cfg"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
#
|
||||||
# perl -p -i -e "
|
# 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_pid\} #\{b:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\
|
# 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_pid\} #\{b: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"
|
# "$cfg"
|
||||||
#
|
#
|
||||||
# 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_disabled "$tmux_conf_new_pane_reconnect_ssh" && _is_true "$tmux_conf_new_pane_reconnect_ssh"; then
|
||||||
# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1'/g" "$cfg"
|
# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1'/g" "$cfg"
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
|
# if ! _is_disabled "$tmux_conf_new_pane_retain_current_path" && _is_true "$tmux_conf_new_pane_retain_current_path"; then
|
||||||
# perl -p -i -e "
|
# perl -p -i -e "
|
||||||
# s/\bsplit-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
|
# s/\bsplit-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
|
||||||
# ;
|
# ;
|
||||||
|
@ -788,7 +804,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
|
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
|
||||||
# if _is_enabled "$tmux_conf_new_session_prompt"; then
|
# if ! _is_disabled "$tmux_conf_new_session_prompt" && _is_true "$tmux_conf_new_session_prompt"; then
|
||||||
# perl -p -i \
|
# perl -p -i \
|
||||||
# -e "s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/" \
|
# -e "s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/" \
|
||||||
# -e ';' \
|
# -e ';' \
|
||||||
|
@ -807,7 +823,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
|
# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
|
||||||
#
|
#
|
||||||
# if [ -n "$command" ]; then
|
# if [ -n "$command" ]; then
|
||||||
# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
|
# if ! _is_disabled "$tmux_conf_copy_to_os_clipboard" && _is_true "$tmux_conf_copy_to_os_clipboard"; then
|
||||||
# perl -p -i -e "s/(?!.*?$command)\bcopy-(?:selection|pipe)(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg"
|
# perl -p -i -e "s/(?!.*?$command)\bcopy-(?:selection|pipe)(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg"
|
||||||
# else
|
# else
|
||||||
# if [ $_tmux_version -ge 320 ]; then
|
# if [ $_tmux_version -ge 320 ]; then
|
||||||
|
@ -863,7 +879,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-$tmux_conf_theme_colour_2}
|
# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-$tmux_conf_theme_colour_2}
|
||||||
#
|
#
|
||||||
# window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg"
|
# window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg"
|
||||||
# if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then
|
# if _is_true "$tmux_conf_theme_highlight_focused_pane"; then
|
||||||
# window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg"
|
# window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg"
|
||||||
# else
|
# else
|
||||||
# window_active_style="default"
|
# window_active_style="default"
|
||||||
|
@ -1372,7 +1388,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
#
|
#
|
||||||
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
|
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
|
||||||
# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$(tmux show -gv '@tpm_plugins')" ]; then
|
# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$(tmux show -gv '@tpm_plugins')" ]; then
|
||||||
# if _is_enabled "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
# if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
||||||
# tmux display 'Uninstalling tpm and plugins...'
|
# tmux display 'Uninstalling tpm and plugins...'
|
||||||
# rm -rf "$TMUX_PLUGIN_MANAGER_PATH"
|
# rm -rf "$TMUX_PLUGIN_MANAGER_PATH"
|
||||||
# tmux display 'Done uninstalling tpm and plugins...'
|
# tmux display 'Done uninstalling tpm and plugins...'
|
||||||
|
@ -1383,7 +1399,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# install_tpm=true
|
# install_tpm=true
|
||||||
# tmux display 'Installing tpm and plugins...'
|
# tmux display 'Installing tpm and plugins...'
|
||||||
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
|
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
|
||||||
# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then
|
# elif { [ -z "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_reload"; }; then
|
||||||
# update_tpm=true
|
# update_tpm=true
|
||||||
# tmux display 'Updating tpm and plugins...'
|
# tmux display 'Updating tpm and plugins...'
|
||||||
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master)
|
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master)
|
||||||
|
|
|
@ -20,21 +20,25 @@
|
||||||
# new window retains current path, possible values are:
|
# new window retains current path, possible values are:
|
||||||
# - true
|
# - true
|
||||||
# - false (default)
|
# - false (default)
|
||||||
|
# - disabled (do not modify new-window bindings)
|
||||||
tmux_conf_new_window_retain_current_path=false
|
tmux_conf_new_window_retain_current_path=false
|
||||||
|
|
||||||
# new pane retains current path, possible values are:
|
# new pane retains current path, possible values are:
|
||||||
# - true (default)
|
# - true (default)
|
||||||
# - false
|
# - false
|
||||||
|
# - disabled (do not modify split-window bindings)
|
||||||
tmux_conf_new_pane_retain_current_path=true
|
tmux_conf_new_pane_retain_current_path=true
|
||||||
|
|
||||||
# new pane tries to reconnect ssh sessions (experimental), possible values are:
|
# new pane tries to reconnect ssh sessions, possible values are:
|
||||||
# - true
|
# - true
|
||||||
# - false (default)
|
# - false (default)
|
||||||
|
# - disabled (do not modify split-window bindings)
|
||||||
tmux_conf_new_pane_reconnect_ssh=false
|
tmux_conf_new_pane_reconnect_ssh=false
|
||||||
|
|
||||||
# prompt for session name when creating a new session, possible values are:
|
# prompt for session name when creating a new session, possible values are:
|
||||||
# - true
|
# - true
|
||||||
# - false (default)
|
# - false (default)
|
||||||
|
# - disabled (do not modify new-session bindings)
|
||||||
tmux_conf_new_session_prompt=false
|
tmux_conf_new_session_prompt=false
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,6 +327,7 @@ tmux_conf_theme_clock_style="24"
|
||||||
# in copy mode, copying selection also copies to the OS clipboard
|
# in copy mode, copying selection also copies to the OS clipboard
|
||||||
# - true
|
# - true
|
||||||
# - false (default)
|
# - false (default)
|
||||||
|
# - disabled
|
||||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
||||||
# on Linux, this requires xsel or xclip
|
# on Linux, this requires xsel or xclip
|
||||||
tmux_conf_copy_to_os_clipboard=false
|
tmux_conf_copy_to_os_clipboard=false
|
||||||
|
|
Loading…
Reference in a new issue