New and old plugin syntax work together
This commit is contained in:
parent
6a5784433b
commit
7ce0326916
3 changed files with 37 additions and 9 deletions
|
@ -8,6 +8,8 @@
|
|||
- revert back to using `-g` flag in new plugin definition syntax
|
||||
- permit leading whitespace with new plugin definition syntax (thanks @chilicuil)
|
||||
- make sure `TMUX_PLUGIN_MANAGER_PATH` always has trailng slash
|
||||
- ensure old/deprecated plugin syntax `set -g @tpm_plugins` works alongside new
|
||||
`set -g @plugin` syntax
|
||||
|
||||
### v1.2.2, 2015-02-08
|
||||
- set GIT_TERMINAL_PROMPT=0 when doing `git clone`, `pull` or `submodule update`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shared functions and constants
|
||||
|
||||
# using @tpm_plugins is now deprecated in favor of using @plugin syntax
|
||||
tpm_plugins_variable_name="@tpm_plugins"
|
||||
SHARED_TPM_PATH=""
|
||||
|
||||
|
@ -11,16 +12,17 @@ shared_set_tpm_path_constant() {
|
|||
SHARED_TPM_PATH="$(echo "$string_path" | sed "s,^\$HOME,$HOME," | sed "s,^~,$HOME,")"
|
||||
}
|
||||
|
||||
_tmux_conf_contents() {
|
||||
cat /etc/tmux.conf ~/.tmux.conf 2>/dev/null
|
||||
}
|
||||
|
||||
shared_get_tpm_plugins_list() {
|
||||
local plugins_list
|
||||
plugins_list="$(tmux show-option -gqv "$tpm_plugins_variable_name")"
|
||||
if [ -z "${plugins_list}" ]; then
|
||||
#read set -g @plugin "tmux-plugins/tmux-example-plugin" entries
|
||||
cat /etc/tmux.conf ~/.tmux.conf 2>/dev/null |
|
||||
awk '/^ *set +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }'
|
||||
else
|
||||
printf "%s\\n" "${plugins_list}"
|
||||
fi
|
||||
# DEPRECATED: lists plugins from @tpm_plugins option
|
||||
echo "$(tmux show-option -gqv "$tpm_plugins_variable_name")"
|
||||
|
||||
# read set -g @plugin "tmux-plugins/tmux-example-plugin" entries
|
||||
_tmux_conf_contents |
|
||||
awk '/^ *set +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }'
|
||||
}
|
||||
|
||||
# Allowed plugin name formats:
|
||||
|
|
|
@ -21,8 +21,32 @@ test_plugin_installation() {
|
|||
teardown_helper
|
||||
}
|
||||
|
||||
test_legacy_and_new_syntax_for_plugin_installation_work() {
|
||||
set_tmux_conf_helper <<- HERE
|
||||
set -g @tpm_plugins " \
|
||||
tmux-plugins/tmux-example-plugin \
|
||||
"
|
||||
set -g @plugin 'tmux-plugins/tmux-copycat'
|
||||
run-shell "$PWD/tpm"
|
||||
HERE
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
"$CURRENT_DIR"/expect_successful_multiple_plugins_download ||
|
||||
fail_helper "Tmux multiple plugins installation fails"
|
||||
|
||||
# check plugin dir exists after download
|
||||
check_dir_exists_helper "$HOME/.tmux/plugins/tmux-example-plugin/" ||
|
||||
fail_helper "Plugin download fails (tmux-example-plugin)"
|
||||
|
||||
check_dir_exists_helper "$HOME/.tmux/plugins/tmux-copycat/" ||
|
||||
fail_helper "Plugin download fails (tmux-copycat)"
|
||||
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
main() {
|
||||
test_plugin_installation
|
||||
test_legacy_and_new_syntax_for_plugin_installation_work
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
||||
|
|
Loading…
Reference in a new issue