2014-08-05 12:45:59 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2015-08-01 18:41:06 -04:00
|
|
|
# Tmux key-binding script.
|
|
|
|
# Scripts intended to be used via the command line are in `bin/` directory.
|
|
|
|
|
|
|
|
# This script:
|
2014-08-05 12:45:59 -04:00
|
|
|
# - shows a list of installed plugins
|
|
|
|
# - starts a prompt to enter the name of the plugin that will be updated
|
|
|
|
|
2023-07-02 22:22:05 -04:00
|
|
|
if command -v tput >/dev/null; then
|
|
|
|
yellow=$(tput setaf 3)
|
|
|
|
norm=$(tput sgr0)
|
|
|
|
fi
|
|
|
|
|
2014-08-05 12:45:59 -04:00
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2015-08-01 18:41:06 -04:00
|
|
|
SCRIPTS_DIR="$CURRENT_DIR/../scripts"
|
2015-08-03 09:12:45 -04:00
|
|
|
HELPERS_DIR="$SCRIPTS_DIR/helpers"
|
2014-08-05 12:45:59 -04:00
|
|
|
|
2015-08-03 11:40:50 -04:00
|
|
|
source "$HELPERS_DIR/plugin_functions.sh"
|
2015-08-03 09:12:45 -04:00
|
|
|
source "$HELPERS_DIR/tmux_echo_functions.sh"
|
|
|
|
source "$HELPERS_DIR/tmux_utils.sh"
|
2014-08-05 12:45:59 -04:00
|
|
|
|
|
|
|
display_plugin_update_list() {
|
2015-08-03 11:40:50 -04:00
|
|
|
local plugins="$(tpm_plugins_list_helper)"
|
2015-08-02 19:25:51 -04:00
|
|
|
tmux_echo "Installed plugins:"
|
|
|
|
tmux_echo ""
|
2014-08-05 12:45:59 -04:00
|
|
|
|
|
|
|
for plugin in $plugins; do
|
|
|
|
# displaying only installed plugins
|
|
|
|
if plugin_already_installed "$plugin"; then
|
2015-08-03 11:40:50 -04:00
|
|
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
2023-07-02 22:22:05 -04:00
|
|
|
tmux_echo " ${yellow}${plugin_name}${norm}"
|
2014-08-05 12:45:59 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-08-02 19:25:51 -04:00
|
|
|
tmux_echo ""
|
|
|
|
tmux_echo "Type plugin name to update it."
|
|
|
|
tmux_echo ""
|
|
|
|
tmux_echo "- \"all\" - updates all plugins"
|
|
|
|
tmux_echo "- ENTER - cancels"
|
2014-08-05 12:45:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
update_plugin_prompt() {
|
|
|
|
tmux command-prompt -p 'plugin update:' " \
|
2015-04-05 18:09:00 -04:00
|
|
|
send-keys C-c; \
|
2015-08-01 18:41:06 -04:00
|
|
|
run-shell '$SCRIPTS_DIR/update_plugin_prompt_handler.sh %1'"
|
2014-08-05 12:45:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
reload_tmux_environment
|
|
|
|
display_plugin_update_list
|
|
|
|
update_plugin_prompt
|
|
|
|
}
|
|
|
|
main
|