From 6fe6f442221573f076b5c08296621a4eb2cdd536 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 28 Oct 2024 19:31:22 +0100 Subject: [PATCH] wip --- .tmux.conf | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index ad3cace..2a0ecee 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -164,6 +164,8 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # # exit the script if any statement returns a non-true return value # set -e # +# unset SHELL +# # unset GREP_OPTIONS # export LC_NUMERIC=C # # shellcheck disable=SC3041 @@ -193,11 +195,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # fi # if [ "$TMUX_PROGRAM" = "tmux" ]; then # tmux() { -# command tmux ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" +# command tmux ${TMUX_SOCKET:+-S} ${TMUX_SOCKET:+"$TMUX_SOCKET"} "$@" # } # else # tmux() { -# "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" +# "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S} ${TMUX_SOCKET:+"$TMUX_SOCKET"} "$@" # } # fi # @@ -1607,8 +1609,26 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # fi # mkdir -p "$TMUX_PLUGIN_MANAGER_PATH" # -# tpm_plugins=$(tmux show -gvq '@tpm_plugins' 2>/dev/null) -# if [ -z "$(tmux show -gv '@plugin' 2>/dev/null)" ] && [ -z "$tpm_plugins" ]; then +# __discover_configuration_files() ( +# IFS=$(printf '\nx') +# IFS=${IFS%?} +# ___discover_configuration_files() { +# for current_file in "$@"; do +# current_file="$(cd "${current_file%/*}" 2>/dev/null && pwd)/${current_file##*/}" || continue +# [ "$discovered_configuration_files" == "${discovered_configuration_files/$current_file/}" ] || continue +# discovered_configuration_files=$(printf '%s\n%s' "$discovered_configuration_files" "$current_file") +# ___discover_configuration_files $(tmux source -nvq "$current_file" | perl -s -n -E 's/current_file/\@current_file/g; if (/^$current_file:\d+:\s*source(?:-file)?((?:\s-[qF]+)*)?\s*(["'"'"'])(.+?)\2$/) { if ($1 ne "") { print `tmux set "\@current_file" "$current_file" \\; display -pF "$3" \\; set -u "\@current_file"` } else { say $3 } }' -- -current_file="$current_file") +# done +# } +# ___discover_configuration_files "$@" +# printf '%s\n' "$discovered_configuration_files" +# ) +# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }' +# $tpm_plugins +# $(IFS=$(printf '\nx'); IFS=${IFS%?}; awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' $(__discover_configuration_files "$TMUX_CONF_LOCAL") 2>/dev/null) +# EOF +# ) +# if [ -z "$tpm_plugins" ]; then # if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then # tmux display 'Uninstalling tpm and plugins...' # tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH @@ -1617,11 +1637,6 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # fi # else # if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$("$TMUX_PROGRAM" display -p '#{pid} #{version} #{socket_path}')" ]; then -# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }' -# $tpm_plugins -# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null) -# EOF -# ) # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" # tmux set -g '@tpm_plugins' "$tpm_plugins" #