Merge 5edba1c1d1
into 59f78857f6
This commit is contained in:
commit
4feba4c714
|
@ -1,20 +1,6 @@
|
||||||
# using @tpm_plugins is now deprecated in favor of using @plugin syntax
|
# using @tpm_plugins is now deprecated in favor of using @plugin syntax
|
||||||
tpm_plugins_variable_name="@tpm_plugins"
|
tpm_plugins_variable_name="@tpm_plugins"
|
||||||
|
|
||||||
# manually expanding tilde char or `$HOME` variable.
|
|
||||||
_manual_expansion() {
|
|
||||||
local path="$1"
|
|
||||||
local expanded_tilde="${path/#\~/$HOME}"
|
|
||||||
echo "${expanded_tilde/#\$HOME/$HOME}"
|
|
||||||
}
|
|
||||||
|
|
||||||
_tpm_path() {
|
|
||||||
local string_path="$(tmux start-server\; show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)/"
|
|
||||||
_manual_expansion "$string_path"
|
|
||||||
}
|
|
||||||
|
|
||||||
_CACHED_TPM_PATH="$(_tpm_path)"
|
|
||||||
|
|
||||||
# Get the absolute path to the users configuration file of TMux.
|
# Get the absolute path to the users configuration file of TMux.
|
||||||
# This includes a prioritized search on different locations.
|
# This includes a prioritized search on different locations.
|
||||||
#
|
#
|
||||||
|
@ -32,23 +18,29 @@ _get_user_tmux_conf() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_tmux_conf_contents() {
|
_exec_tmux() {
|
||||||
user_config=$(_get_user_tmux_conf)
|
local OPTS=()
|
||||||
cat /etc/tmux.conf "$user_config" 2>/dev/null
|
if [[ -z "$TMUX" ]]; then
|
||||||
if [ "$1" == "full" ]; then # also output content from sourced files
|
OPTS+=(-f "$(_get_user_tmux_conf)" start-server \;)
|
||||||
local file
|
|
||||||
for file in $(_sourced_files); do
|
|
||||||
cat $(_manual_expansion "$file") 2>/dev/null
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
tmux "${OPTS[@]}" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# return files sourced from tmux config files
|
# manually expanding tilde char or `$HOME` variable.
|
||||||
_sourced_files() {
|
_manual_expansion() {
|
||||||
_tmux_conf_contents |
|
local path="$1"
|
||||||
awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }'
|
local expanded_tilde="${path/#\~/$HOME}"
|
||||||
|
echo "${expanded_tilde/#\$HOME/$HOME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_tpm_path() {
|
||||||
|
local string_path="$(_exec_tmux show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)/"
|
||||||
|
_manual_expansion "$string_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
_CACHED_TPM_PATH="$(_tpm_path)"
|
||||||
|
|
||||||
# Want to be able to abort in certain cases
|
# Want to be able to abort in certain cases
|
||||||
trap "exit 1" TERM
|
trap "exit 1" TERM
|
||||||
export TOP_PID=$$
|
export TOP_PID=$$
|
||||||
|
@ -69,12 +61,9 @@ tpm_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tpm_plugins_list_helper() {
|
tpm_plugins_list_helper() {
|
||||||
# lists plugins from @tpm_plugins option
|
# lists plugins from @tpm_plugins option and @plugins
|
||||||
echo "$(tmux start-server\; show-option -gqv "$tpm_plugins_variable_name")"
|
_exec_tmux show-option -gqv "$tpm_plugins_variable_name" \; \
|
||||||
|
show-option -gqv "@plugin" \;
|
||||||
# read set -g @plugin "tmux-plugins/tmux-example-plugin" entries
|
|
||||||
_tmux_conf_contents "full" |
|
|
||||||
awk '/^[ \t]*set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allowed plugin name formats:
|
# Allowed plugin name formats:
|
||||||
|
|
Loading…
Reference in New Issue