File tree Expand file tree Collapse file tree 4 files changed +15
-8
lines changed Expand file tree Collapse file tree 4 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
2828
2929# Other examples:
3030# set -g @plugin 'github_username/plugin_name'
31+ # set -g @plugin 'github_username/plugin_name#branch'
3132# set -g @plugin 'git@github.com:user/plugin'
3233# set -g @plugin 'git@bitbucket.com:user/plugin'
3334
Original file line number Diff line number Diff line change 1515clone () {
1616 local plugin=" $1 "
1717 cd " $( tpm_path) " &&
18- GIT_TERMINAL_PROMPT=0 git clone --recursive " $plugin " > /dev/null 2>&1
18+ GIT_TERMINAL_PROMPT=0 git clone -b " $branch " --single-branch - -recursive " $plugin " > /dev/null 2>&1
1919}
2020
2121# tries cloning:
2222# 1. plugin name directly - works if it's a valid git url
2323# 2. expands the plugin name to point to a github repo and tries cloning again
2424clone_plugin () {
2525 local plugin=" $1 "
26- clone " $plugin " ||
27- clone " https://git::@github.com/$plugin "
26+ local branch=" $2 "
27+ clone " $plugin " " $branch " ||
28+ clone " https://git::@github.com/$plugin " " $branch "
2829}
2930
3031# clone plugin and produce output
3132install_plugin () {
3233 local plugin=" $1 "
34+ local branch=` [ -z " $2 " ] && echo " master" || echo " $2 " `
3335 local plugin_name=" $( plugin_name_helper " $plugin " ) "
3436
3537 if plugin_already_installed " $plugin " ; then
3638 echo_ok " Already installed \" $plugin_name \" "
3739 else
3840 echo_ok " Installing \" $plugin_name \" "
39- clone_plugin " $plugin " &&
41+ clone_plugin " $plugin " " $branch " &&
4042 echo_ok " \" $plugin_name \" download success" ||
4143 echo_err " \" $plugin_name \" download fail"
4244 fi
@@ -45,7 +47,8 @@ install_plugin() {
4547install_plugins () {
4648 local plugins=" $( tpm_plugins_list_helper) "
4749 for plugin in $plugins ; do
48- install_plugin " $plugin "
50+ IFS=' #' read -ra plugin <<< " $plugin"
51+ install_plugin " ${plugin[0]} " " ${plugin[1]} "
4952 done
5053}
5154
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ source_plugins() {
3030 local plugin plugin_path
3131 local plugins=" $( tpm_plugins_list_helper) "
3232 for plugin in $plugins ; do
33- plugin_path=" $( plugin_path_helper " $plugin " ) "
33+ IFS=' #' read -ra plugin <<< " $plugin"
34+ plugin_path=" $( plugin_path_helper " ${plugin[0]} " ) "
3435 silently_source_all_tmux_files " $plugin_path "
3536 done
3637}
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ update_all() {
3737 echo_ok " "
3838 local plugins=" $( tpm_plugins_list_helper) "
3939 for plugin in $plugins ; do
40- local plugin_name=" $( plugin_name_helper " $plugin " ) "
40+ IFS=' #' read -ra plugin <<< " $plugin"
41+ local plugin_name=" $( plugin_name_helper " ${plugin[0]} " ) "
4142 # updating only installed plugins
4243 if plugin_already_installed " $plugin_name " ; then
4344 update " $plugin_name " &
@@ -49,7 +50,8 @@ update_all() {
4950update_plugins () {
5051 local plugins=" $* "
5152 for plugin in $plugins ; do
52- local plugin_name=" $( plugin_name_helper " $plugin " ) "
53+ IFS=' #' read -ra plugin <<< " $plugin"
54+ local plugin_name=" $( plugin_name_helper " ${plugin[0]} " ) "
5355 if plugin_already_installed " $plugin_name " ; then
5456 update " $plugin_name " &
5557 else
You can’t perform that action at this time.
0 commit comments