added a way to mark set/bind/unbind commands as important in ~/.tmux.conf.local, closes #571

inspired by css, any set/bind/unbind command ending with #!important will be
executed honored, e.g.:

bind-key -T copy-mode-vi Escape send-keys -X clear-selection #!important
pull/526/merge
Gregory Pakosz 5 months ago
parent 52f1c4a3b1
commit 18a111ff93
  1. 41
      .tmux.conf
  2. 3
      .tmux.conf.local

@ -165,13 +165,9 @@ bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# -- user defined overrides ----------------------------------------------------
source -q ~/.tmux.conf.local
# -- 8< ------------------------------------------------------------------------
source -q ~/.tmux.conf.local
run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
@ -719,22 +715,22 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _split_window_ssh "$@"
# }
#
# _apply_overrides() {
# _apply_24b() {
# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-auto}
# tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour}
# if [ x"$tmux_conf_24b_colour" = x"auto" ]; then
# case "$COLORTERM" in
# truecolor|24bit)
# apply_overrides=true
# apply_24b=true
# ;;
# esac
# if [ x"$apply_overrides" = x"" ] && [ x"$(tput colors)" = x"16777216" ]; then
# apply_overrides=true
# if [ x"$apply_24b" = x"" ] && [ x"$(tput colors)" = x"16777216" ]; then
# apply_24b=true
# fi
# elif _is_true "$tmux_conf_24b_colour"; then
# apply_overrides=true
# apply_24b=true
# fi
# if [ x"$apply_overrides" = x"true" ]; then
# if [ x"$apply_24b" = x"true" ]; then
# case "$TERM" in
# screen-*|tmux-*)
# ;;
@ -1453,6 +1449,20 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\" \"$tmux_conf_uninstall_plugins_on_reload\""
# }
#
# _apply_important() {
# cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT
#
# if perl -n -e 'print if /^\s*(?:set|bind|unbind).+?#!important\s*$/' ~/.tmux.conf.local 2>/dev/null > "$cfg.local"; then
# if ! tmux source-file "$cfg.local"; then
# verbose_flag=$(tmux source-file -v /dev/null 2> /dev/null && printf -- '-v' || true)
# while ! out=$(tmux source-file "$verbose_flag" "$cfg.local"); do
# line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2)
# perl -n -i -e "if ($. != $line) { print }" "$cfg.local"
# done
# fi
# fi
# }
#
# _apply_configuration() {
#
# window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)"
@ -1495,15 +1505,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ;;
# esac
#
# _apply_overrides
# _apply_24b
# _apply_theme&
# _apply_bindings&
#
# # shellcheck disable=SC2046
# tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}')
# wait
#
# _apply_plugins
# _apply_important
#
# # shellcheck disable=SC2046
# tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}')
# }
#
# _urlview() {

@ -354,6 +354,9 @@ tmux_conf_copy_to_os_clipboard=false
# set -g prefix C-a
# bind C-a send-prefix
# if you don't want Oh my tmux! to alter a binding, use #!important
# bind v new-window -c #{pane_current_path} #!important
# move status line to top
#set -g status-position top

Loading…
Cancel
Save