43 lines
1.2 KiB
Bash
Executable file
43 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
SUPPORTED_TMUX_VERSION="1.9"
|
|
|
|
# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
|
|
# Default tpm path is "$HOME/.tmux/plugins/". That's where all the plugins are
|
|
# downloaded.
|
|
#
|
|
# Put this in `.tmux.conf` to override the default:
|
|
# `set-environment -g TMUX_PLUGIN_MANAGER_PATH "/some/other/path/"`
|
|
set_tpm_path() {
|
|
$CURRENT_DIR/scripts/set_tpm_path.sh >/dev/null 2>&1
|
|
}
|
|
|
|
# 1. Fetches plugin names from `@tpm_plugins` user variable.
|
|
# 2. Creates full plugin path
|
|
# 3. Sources all *.tmux files from each of the plugin directories
|
|
# - no errors raised if directory does not exist
|
|
# Files are sourced as tmux config files, not as shell scripts!
|
|
source_plugins() {
|
|
$CURRENT_DIR/scripts/source_plugins.sh >/dev/null 2>&1
|
|
}
|
|
|
|
# Defines key binding:
|
|
# prefix + I - downloads TPM plugins and reloads TMUX environment.
|
|
set_tpm_key_binding() {
|
|
tmux bind-key I run-shell "$CURRENT_DIR/scripts/sync_plugins.sh >/dev/null 2>&1"
|
|
}
|
|
|
|
supported_tmux_version_ok() {
|
|
$CURRENT_DIR/scripts/check_tmux_version.sh "$SUPPORTED_TMUX_VERSION"
|
|
}
|
|
|
|
main() {
|
|
if supported_tmux_version_ok; then
|
|
set_tpm_path
|
|
set_tpm_key_binding
|
|
source_plugins
|
|
fi
|
|
}
|
|
main
|