Merge 281d750dca
into 99469c4a9b
This commit is contained in:
commit
7f2eadd71c
|
@ -31,6 +31,8 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||||
# set -g @plugin 'github_username/plugin_name#branch'
|
# set -g @plugin 'github_username/plugin_name#branch'
|
||||||
# set -g @plugin 'git@github.com:user/plugin'
|
# set -g @plugin 'git@github.com:user/plugin'
|
||||||
# set -g @plugin 'git@bitbucket.com:user/plugin'
|
# set -g @plugin 'git@bitbucket.com:user/plugin'
|
||||||
|
# set -g @plugin 'awesome_plugin::github_username/plugin_name'
|
||||||
|
# set -g @plugin 'awesome_plugin::git@github.com:user/plugin'
|
||||||
|
|
||||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
||||||
run '~/.tmux/plugins/tpm/tpm'
|
run '~/.tmux/plugins/tpm/tpm'
|
||||||
|
|
|
@ -80,8 +80,15 @@ tpm_plugins_list_helper() {
|
||||||
# Allowed plugin name formats:
|
# Allowed plugin name formats:
|
||||||
# 1. "git://github.com/user/plugin_name.git"
|
# 1. "git://github.com/user/plugin_name.git"
|
||||||
# 2. "user/plugin_name"
|
# 2. "user/plugin_name"
|
||||||
|
# 3. "plugin_name::git://github.com/user/plugin_name.git"
|
||||||
|
# 4. "plugin_name::user/plugin"
|
||||||
plugin_name_helper() {
|
plugin_name_helper() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
|
# if a plugin name is specified, use it
|
||||||
|
if [[ "$plugin" = *::* ]]; then
|
||||||
|
echo "${plugin%%::*}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
# get only the part after the last slash, e.g. "plugin_name.git"
|
# get only the part after the last slash, e.g. "plugin_name.git"
|
||||||
local plugin_basename="$(basename "$plugin")"
|
local plugin_basename="$(basename "$plugin")"
|
||||||
# remove ".git" extension (if it exists) to get only "plugin_name"
|
# remove ".git" extension (if it exists) to get only "plugin_name"
|
||||||
|
|
|
@ -15,12 +15,13 @@ fi
|
||||||
clone() {
|
clone() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
local branch="$2"
|
local branch="$2"
|
||||||
|
local plugin_name="$3"
|
||||||
if [ -n "$branch" ]; then
|
if [ -n "$branch" ]; then
|
||||||
cd "$(tpm_path)" &&
|
cd "$(tpm_path)" &&
|
||||||
GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" >/dev/null 2>&1
|
GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" "$plugin_name" >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
cd "$(tpm_path)" &&
|
cd "$(tpm_path)" &&
|
||||||
GIT_TERMINAL_PROMPT=0 git clone --single-branch --recursive "$plugin" >/dev/null 2>&1
|
GIT_TERMINAL_PROMPT=0 git clone --single-branch --recursive "$plugin" "$plugin_name" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +29,12 @@ clone() {
|
||||||
# 1. plugin name directly - works if it's a valid git url
|
# 1. plugin name directly - works if it's a valid git url
|
||||||
# 2. expands the plugin name to point to a GitHub repo and tries cloning again
|
# 2. expands the plugin name to point to a GitHub repo and tries cloning again
|
||||||
clone_plugin() {
|
clone_plugin() {
|
||||||
local plugin="$1"
|
# strip the eventual plugin name
|
||||||
|
local plugin="${1#*::}"
|
||||||
local branch="$2"
|
local branch="$2"
|
||||||
clone "$plugin" "$branch" ||
|
local plugin_name="$3"
|
||||||
clone "https://git::@github.com/$plugin" "$branch"
|
clone "$plugin" "$branch" "$plugin_name" ||
|
||||||
|
clone "https://git::@github.com/$plugin" "$branch" "$plugin_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
# clone plugin and produce output
|
# clone plugin and produce output
|
||||||
|
@ -44,7 +47,7 @@ install_plugin() {
|
||||||
echo_ok "Already installed \"$plugin_name\""
|
echo_ok "Already installed \"$plugin_name\""
|
||||||
else
|
else
|
||||||
echo_ok "Installing \"$plugin_name\""
|
echo_ok "Installing \"$plugin_name\""
|
||||||
clone_plugin "$plugin" "$branch" &&
|
clone_plugin "$plugin" "$branch" "$plugin_name" &&
|
||||||
echo_ok " \"$plugin_name\" download success" ||
|
echo_ok " \"$plugin_name\" download success" ||
|
||||||
echo_err " \"$plugin_name\" download fail"
|
echo_err " \"$plugin_name\" download fail"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue