From 5de37f98bb89cd67901c76a34ad084bb4e35b0b0 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Mon, 10 Aug 2015 20:18:32 +0200 Subject: [PATCH 01/27] Add troubleshooting docs --- CHANGELOG.md | 1 + README.md | 2 ++ docs/tpm_not_working.md | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 docs/tpm_not_working.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d141843..5f16917 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - upgrade to new version of `tmux-test` - bug: when using `emacs` copy mode, Enter does not quit screen after tpm installation/update. Fix by making `Escape` the key for emacs mode. +- add a doc with troubleshooting instructions ### v3.0.0, 2015-08-03 - refactor `shared_set_tpm_path_constant` function diff --git a/README.md b/README.md index 9559d83..1493e4a 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ For more plugins, check [here](https://github.com/tmux-plugins). ### Docs +- [Help, tpm not working](docs/tpm_not_working.md) - problem solutions + More advanced features and instructions, regular users probably do not need this: diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md new file mode 100644 index 0000000..95e3ba7 --- /dev/null +++ b/docs/tpm_not_working.md @@ -0,0 +1,28 @@ +# Help, tpm not working! + +Here's the list of issues users had with `tpm`: + +> Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even + defined. + +[Issue #22](https://github.com/tmux-plugins/tpm/issues/22) + +- Do you have required `tmux` version to run `tpm`?
+ Check `tmux` version with `$ tmux -V` command and make sure it's higher or + equal to the required version for `tpm` as stated in the readme. + +- ZSH tmux plugin might be causing issues.
+ If you have it installed, try disabling it and see if `tpm` works then. + +> Weird sequence of characters show up when installing or updating plugins + +[Issue #25](https://github.com/tmux-plugins/tpm/issues/25) + +- This could be caused by [tmuxline.vim](https://github.com/edkolev/tmuxline.vim) + plugin. Uninstall it and see if things work. + +> "failed to connect to server" error when sourcing .tmux.conf + +[Issue #48](https://github.com/tmux-plugins/tpm/issues/48) + +- Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`. From a6e34acf0e3c03ea25d3ef2e3f79fdd8d0b198f3 Mon Sep 17 00:00:00 2001 From: Treri Date: Tue, 8 Sep 2015 16:38:15 +0800 Subject: [PATCH 02/27] match 'set-option -g @plugin' and 'set -g @plugin' --- scripts/helpers/plugin_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index e1da249..124c40f 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -43,7 +43,7 @@ tpm_plugins_list_helper() { # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries _tmux_conf_contents "full" | - awk '/^ *set +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' + awk '/^ *set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' } # Allowed plugin name formats: From 5073d2f3824d45efdbde3db93eb6626ab70a645b Mon Sep 17 00:00:00 2001 From: cclay Date: Tue, 15 Sep 2015 09:12:39 -0400 Subject: [PATCH 03/27] Update how_to_create_plugin.md typo --- docs/how_to_create_plugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to_create_plugin.md b/docs/how_to_create_plugin.md index a7c6961..19002da 100644 --- a/docs/how_to_create_plugin.md +++ b/docs/how_to_create_plugin.md @@ -104,5 +104,5 @@ If the plugin is on Github, your users will be able to use the shorthand of Hopefully, that was easy. As you can see, it's mostly shell scripting. -You can use other scripting languages (ruby, phyton etc) but plain old shell +You can use other scripting languages (ruby, python etc) but plain old shell is preferred because of portability. From c53ccb37ae02b1f4b8e5b29fdd4e46e488a8a821 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Sun, 20 Sep 2015 01:32:35 +0200 Subject: [PATCH 04/27] Force `LF` eol with .gitattributes --- .gitattributes | 9 +++++++++ CHANGELOG.md | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..80772e4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# Force text files to have unix eols, so Windows/Cygwin does not break them +*.* eol=lf + +# These files are unfortunately not recognized as text files so +# explicitly listing them here +tpm eol=lf +bin/* eol=lf +bindings/* eol=lf +tests/* eol=lf diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f16917..b565e8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - bug: when using `emacs` copy mode, Enter does not quit screen after tpm installation/update. Fix by making `Escape` the key for emacs mode. - add a doc with troubleshooting instructions +- add `.gitattributes` file that forces linefeed characters (classic `\n`) as + line endings - helps with misconfigured git on windows/cygwin ### v3.0.0, 2015-08-03 - refactor `shared_set_tpm_path_constant` function From f6a6d879b0d587f209766998cb85037b92db5889 Mon Sep 17 00:00:00 2001 From: Larry Lv Date: Wed, 23 Sep 2015 22:22:27 +0800 Subject: [PATCH 05/27] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1493e4a..c768b62 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced. ### Uninstalling plugins 1. remove (or comment out) plugin from the list -2. hit `prefix + alt + u` (u as in **u**install) to remove the plugin +2. hit `prefix + alt + u` (u as in **u**ninstall) to remove the plugin All the plugins are installed to `~/.tmux/plugins/` so alternatively you can find plugin directory there and remove it. From 01c714fcad32af1560ec427000631f5068a8b3c7 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Thu, 8 Oct 2015 01:11:27 +0200 Subject: [PATCH 06/27] Add info that cygwin is supported Closes #42 --- CHANGELOG.md | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b565e8a..0d83ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - add a doc with troubleshooting instructions - add `.gitattributes` file that forces linefeed characters (classic `\n`) as line endings - helps with misconfigured git on windows/cygwin +- readme update: announce Cygwin support ### v3.0.0, 2015-08-03 - refactor `shared_set_tpm_path_constant` function diff --git a/README.md b/README.md index c768b62..78147a8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Installs and loads TMUX plugins. +Tested and working on Linux, OSX and Cygwin. + ### Installation Requirements: `tmux` version 1.9 (or higher), `git`, `bash`. From 527d12321108d52cc5b53cd251f2a058fd07bf0e Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Thu, 8 Oct 2015 01:24:08 +0200 Subject: [PATCH 07/27] Test for 'set-option' plugin definition --- tests/test_plugin_installation.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_plugin_installation.sh b/tests/test_plugin_installation.sh index 65b1899..94fb674 100755 --- a/tests/test_plugin_installation.sh +++ b/tests/test_plugin_installation.sh @@ -29,6 +29,22 @@ test_plugin_installation_via_tmux_key_binding() { teardown_helper } +test_plugin_installation_via_tmux_key_binding_set_option() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-option -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding][set-option] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][set-option] plugin download fails" + + teardown_helper +} + test_plugin_installation_custom_dir_via_tmux_key_binding() { set_tmux_conf_helper <<- HERE set -g mode-keys vi From 9f44b6fca9b9084857234f86cf97629610df1dfc Mon Sep 17 00:00:00 2001 From: Matthew Marchese Date: Wed, 4 Nov 2015 15:01:25 -0800 Subject: [PATCH 08/27] Added a bit more clarity. It's important to understand installing and uninstalling plugins is case sensitive. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 78147a8..14765b7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Installs and loads TMUX plugins. -Tested and working on Linux, OSX and Cygwin. +Tested and working on Linux, OSX, and Cygwin. ### Installation @@ -36,19 +36,19 @@ Reload TMUX environment so TPM is sourced: That's it! (**Note:** using `set -g @tpm_plugins` is deprecated, but still works alongside -new syntax) +new syntax.) ### Installing plugins -1. add new plugin to `.tmux.conf` with `set -g @plugin '...'` -2. hit `prefix + I` (I as in **I**nstall) to fetch the plugin +1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` +2. Press `prefix + I` (capital I, as in **I**nstall) to fetch the plugin. You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced. ### Uninstalling plugins -1. remove (or comment out) plugin from the list -2. hit `prefix + alt + u` (u as in **u**ninstall) to remove the plugin +1. Remove (or comment out) plugin from the list. +2. Press `prefix + alt + u` (lowercase u as in **u**ninstall) to remove the plugin. All the plugins are installed to `~/.tmux/plugins/` so alternatively you can find plugin directory there and remove it. @@ -56,8 +56,8 @@ find plugin directory there and remove it. ### Key bindings `prefix + I` -- installs new plugins from github or any other git repo -- refreshes TMUX environment +- Installs new plugins from GitHub or any other git repository +- Refreshes TMUX environment `prefix + U` - updates plugin(s) From abffb251ac23c2e2f5f594df6c300b8783f9860c Mon Sep 17 00:00:00 2001 From: Brandon Zylstra Date: Sat, 14 Nov 2015 23:11:43 -0500 Subject: [PATCH 09/27] make script executable only for the owner Making files executable for the world opens a potential security risk. It might be unlikely that it can be exploited, but it's a better practice to avoid doing anyway. --- docs/how_to_create_plugin.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how_to_create_plugin.md b/docs/how_to_create_plugin.md index 19002da..b1a68f9 100644 --- a/docs/how_to_create_plugin.md +++ b/docs/how_to_create_plugin.md @@ -27,7 +27,7 @@ directory. That's how plugins are run. Create a plugin run file in plugin directory: $ touch my_plugin.tmux - $ chmod +x my_plugin.tmux + $ chmod u+x my_plugin.tmux You can have more than one `*.tmux` file, and all will get executed. However, usually you'll need just one. @@ -69,7 +69,7 @@ Now that we have the binding, let's create a script that's invoked with $ mkdir scripts $ touch scripts/tmux_list_plugins.sh - $ chmod +x scripts/tmux_list_plugins.sh + $ chmod u+x scripts/tmux_list_plugins.sh And here's the script content: From 620f06c524cc6ea2761c7cbc4640ac0a3fc3e7b4 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Mon, 14 Dec 2015 01:21:47 +0100 Subject: [PATCH 10/27] Undeprecate 'set -g @tpm_plugins' --- CHANGELOG.md | 1 + README.md | 3 --- docs/tpm_not_working.md | 26 ++++++++++++++++++++++++++ scripts/helpers/plugin_functions.sh | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d83ca0..672d3e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - add `.gitattributes` file that forces linefeed characters (classic `\n`) as line endings - helps with misconfigured git on windows/cygwin - readme update: announce Cygwin support +- un-deprecate old plugin definition syntax: `set -g @tpm_plugins` ### v3.0.0, 2015-08-03 - refactor `shared_set_tpm_path_constant` function diff --git a/README.md b/README.md index 14765b7..3ba4330 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,6 @@ Reload TMUX environment so TPM is sourced: That's it! -(**Note:** using `set -g @tpm_plugins` is deprecated, but still works alongside -new syntax.) - ### Installing plugins 1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md index 95e3ba7..5c84e7e 100644 --- a/docs/tpm_not_working.md +++ b/docs/tpm_not_working.md @@ -14,6 +14,32 @@ Here's the list of issues users had with `tpm`: - ZSH tmux plugin might be causing issues.
If you have it installed, try disabling it and see if `tpm` works then. +> Help, I'm using `tmux -f /path/to/my_tmux.conf` option to start Tmux and for +some reason plugins aren't loaded!? + +[Issue #57](https://github.com/tmux-plugins/tpm/issues/57) + +`tpm` has a known issue when using alternative config file with `-f` option. +The solution is to use alternative plugin definition. Here are the steps to +make it work: + +1. remove all `set -g @plugin` lines from tmux config file +2. in the config file define the plugins in the following way: + + # List of plugins + set -g @tpm_plugins ' \ + tmux-plugins/tpm \ + tmux-plugins/tmux-sensible \ + tmux-plugins/tmux-resurrect \ + ' + + # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) + run '~/.tmux/plugins/tpm/tpm' + +3. Reload TMUX environment so TPM is sourced: `$ tmux source /path/to/my_tmux.conf` + +The plugins should now be working. + > Weird sequence of characters show up when installing or updating plugins [Issue #25](https://github.com/tmux-plugins/tpm/issues/25) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index 124c40f..6ee7a5d 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -38,7 +38,7 @@ tpm_path() { } tpm_plugins_list_helper() { - # DEPRECATED: lists plugins from @tpm_plugins option + # lists plugins from @tpm_plugins option echo "$(tmux start-server\; show-option -gqv "$tpm_plugins_variable_name")" # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries From 51ff07a729b4b67f692936ad75cb0650149afbb4 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Mon, 14 Dec 2015 01:26:16 +0100 Subject: [PATCH 11/27] Docs wording change --- docs/tpm_not_working.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md index 5c84e7e..459ab01 100644 --- a/docs/tpm_not_working.md +++ b/docs/tpm_not_working.md @@ -14,14 +14,14 @@ Here's the list of issues users had with `tpm`: - ZSH tmux plugin might be causing issues.
If you have it installed, try disabling it and see if `tpm` works then. -> Help, I'm using `tmux -f /path/to/my_tmux.conf` option to start Tmux and for -some reason plugins aren't loaded!? +> Help, I'm using custom config file with `tmux -f /path/to/my_tmux.conf` +to start Tmux and for some reason plugins aren't loaded!? [Issue #57](https://github.com/tmux-plugins/tpm/issues/57) -`tpm` has a known issue when using alternative config file with `-f` option. -The solution is to use alternative plugin definition. Here are the steps to -make it work: +`tpm` has a known issue when using custom config file with `-f` option. +The solution is to use alternative plugin definition syntax. Here are the steps +to make it work: 1. remove all `set -g @plugin` lines from tmux config file 2. in the config file define the plugins in the following way: From a44cab3fcf12600dd768d57839da70a62a3c4051 Mon Sep 17 00:00:00 2001 From: JackDrogon Date: Mon, 1 Feb 2016 14:41:03 +0800 Subject: [PATCH 12/27] Fix plugin line start with tab problem --- scripts/helpers/plugin_functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index 6ee7a5d..b1dfb3d 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -28,7 +28,7 @@ _tmux_conf_contents() { # return files sourced from tmux config files _sourced_files() { _tmux_conf_contents | - awk '/^ *source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' + awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' } # PUBLIC FUNCTIONS BELOW @@ -43,7 +43,7 @@ tpm_plugins_list_helper() { # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries _tmux_conf_contents "full" | - awk '/^ *set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' + awk '/^[ \t]*set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' } # Allowed plugin name formats: From 9bfbac2767b68fb87d1ddf2b8b28f188b3934057 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Sun, 21 Aug 2016 06:52:18 +0200 Subject: [PATCH 13/27] Better issues separation in tpm_not_working.md --- docs/tpm_not_working.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md index 459ab01..99bdfb7 100644 --- a/docs/tpm_not_working.md +++ b/docs/tpm_not_working.md @@ -2,10 +2,12 @@ Here's the list of issues users had with `tpm`: +
+ > Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even defined. -[Issue #22](https://github.com/tmux-plugins/tpm/issues/22) +Related [issue #22](https://github.com/tmux-plugins/tpm/issues/22) - Do you have required `tmux` version to run `tpm`?
Check `tmux` version with `$ tmux -V` command and make sure it's higher or @@ -14,10 +16,12 @@ Here's the list of issues users had with `tpm`: - ZSH tmux plugin might be causing issues.
If you have it installed, try disabling it and see if `tpm` works then. +
+ > Help, I'm using custom config file with `tmux -f /path/to/my_tmux.conf` to start Tmux and for some reason plugins aren't loaded!? -[Issue #57](https://github.com/tmux-plugins/tpm/issues/57) +Related [issue #57](https://github.com/tmux-plugins/tpm/issues/57) `tpm` has a known issue when using custom config file with `-f` option. The solution is to use alternative plugin definition syntax. Here are the steps @@ -40,15 +44,19 @@ to make it work: The plugins should now be working. +
+ > Weird sequence of characters show up when installing or updating plugins -[Issue #25](https://github.com/tmux-plugins/tpm/issues/25) +Related: [issue #25](https://github.com/tmux-plugins/tpm/issues/25) - This could be caused by [tmuxline.vim](https://github.com/edkolev/tmuxline.vim) plugin. Uninstall it and see if things work. +
+ > "failed to connect to server" error when sourcing .tmux.conf -[Issue #48](https://github.com/tmux-plugins/tpm/issues/48) +Related: [issue #48](https://github.com/tmux-plugins/tpm/issues/48) - Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`. From b4c89884e0a8a97fdc1fd470688677867e14e801 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Sun, 21 Aug 2016 07:12:43 +0200 Subject: [PATCH 14/27] Document windows/cygwin issue with line endings Closes #81 --- docs/tpm_not_working.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md index 99bdfb7..87d2998 100644 --- a/docs/tpm_not_working.md +++ b/docs/tpm_not_working.md @@ -60,3 +60,21 @@ Related: [issue #25](https://github.com/tmux-plugins/tpm/issues/25) Related: [issue #48](https://github.com/tmux-plugins/tpm/issues/48) - Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`. + +
+ +> tpm not working: '~/.tmux/plugins/tpm/tpm' returned 2 (Windows / Cygwin) + +Related: [issue #81](https://github.com/tmux-plugins/tpm/issues/81) + +This issue is most likely caused by Windows line endings. For example, if you +have git's `core.autocrlf` option set to `true`, git will automatically convert +all the files to Windows line endings which might cause a problem. + +The solution is to convert all line ending to Unix newline characters. This +command handles that for all files under `.tmux/` dir (skips `.git` +subdirectories): + +```bash +find ~/.tmux -type d -name '.git*' -prune -o -type f -print0 | xargs -0 dos2unix +``` From 9e082ff1b3fad5597c45f7128ce9d932b3643f38 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Sat, 12 Nov 2016 15:12:50 -0500 Subject: [PATCH 15/27] Update plugins in parallel --- scripts/update_plugin.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/update_plugin.sh b/scripts/update_plugin.sh index d923d83..4fc44d2 100755 --- a/scripts/update_plugin.sh +++ b/scripts/update_plugin.sh @@ -27,7 +27,6 @@ pull_changes() { update() { local plugin="$1" - echo_ok "Updating \"$plugin\"" $(pull_changes "$plugin" > /dev/null 2>&1) && echo_ok " \"$plugin\" update success" || echo_err " \"$plugin\" update fail" @@ -41,9 +40,10 @@ update_all() { local plugin_name="$(plugin_name_helper "$plugin")" # updating only installed plugins if plugin_already_installed "$plugin_name"; then - update "$plugin_name" + update "$plugin_name" & fi done + wait } update_plugins() { @@ -51,11 +51,12 @@ update_plugins() { for plugin in $plugins; do local plugin_name="$(plugin_name_helper "$plugin")" if plugin_already_installed "$plugin_name"; then - update "$plugin_name" + update "$plugin_name" & else - echo_err "$plugin_name not installed!" + echo_err "$plugin_name not installed!" & fi done + wait } main() { From 1579534c2e3dda36d0037661f3aeb8af05bd3da5 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 1 Dec 2016 22:55:12 -0500 Subject: [PATCH 16/27] Prevent clean_plugins from deleting root If tmux was not yet configured to initialize the Tmux Plugin Manager, the variable for the plugin home was not being set. This was resulting in a `rm -rf /` which is pretty nuclear. Fixes: https://github.com/tmux-plugins/tpm/issues/58 --- scripts/helpers/plugin_functions.sh | 13 +++++++++++++ scripts/update_plugin.sh | 1 + 2 files changed, 14 insertions(+) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index b1dfb3d..d2778d5 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -31,9 +31,22 @@ _sourced_files() { awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' } +# Want to be able to abort in certain cases +trap "exit 1" TERM +export TOP_PID=$$ + +_fatal_error_abort() { + echo >&2 "Aborting." + kill -s TERM $TOP_PID +} + # PUBLIC FUNCTIONS BELOW tpm_path() { + if [ "$_CACHED_TPM_PATH" == "/" ]; then + echo >&2 "FATAL: Tmux Plugin Manager not configured in tmux.conf" + _fatal_error_abort + fi echo "$_CACHED_TPM_PATH" } diff --git a/scripts/update_plugin.sh b/scripts/update_plugin.sh index 4fc44d2..7d856ee 100755 --- a/scripts/update_plugin.sh +++ b/scripts/update_plugin.sh @@ -60,6 +60,7 @@ update_plugins() { } main() { + ensure_tpm_path_exists if [ "$1" == "all" ]; then update_all else From 350fa9ee5fe538ef86ba3df1f7cdc1402dd73d56 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 12 Dec 2016 21:36:57 -0500 Subject: [PATCH 17/27] Clarify sourcing tmux.conf Avoid any confusion with starting tmux with the `-f` option. Fixes https://github.com/tmux-plugins/tpm/issues/89 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ba4330..647fd6f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Put this at the bottom of `.tmux.conf`: Reload TMUX environment so TPM is sourced: - # type this in terminal + # type this in terminal if tmux is already running $ tmux source ~/.tmux.conf That's it! From c5c997bdde5d6a46d4b852e0a8164a30ca1dd0a4 Mon Sep 17 00:00:00 2001 From: Jon Robison Date: Fri, 16 Dec 2016 13:54:46 -0500 Subject: [PATCH 18/27] -Add auto plugin installation --- docs/automatic_tpm_installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/automatic_tpm_installation.md b/docs/automatic_tpm_installation.md index 22ded34..630573f 100644 --- a/docs/automatic_tpm_installation.md +++ b/docs/automatic_tpm_installation.md @@ -2,11 +2,11 @@ One of the first things we do on a new machine is cloning our dotfiles. Not everything comes with them though, so for example `tpm` most likely won't be installed. -If you wanna install `tpm` automatically when tmux is started, put the following snippet in `.tmux.conf` before the final `run '~/.tmux/plugins/tpm/tpm'`: +If you want to install `tpm` and plugins automatically when tmux is started, put the following snippet in `.tmux.conf` before the final `run '~/.tmux/plugins/tpm/tpm'`: ``` if "test ! -d ~/.tmux/plugins/tpm" \ - "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'" + "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" ``` -This useful tip was submitted by @acr4. +This useful tip was submitted by @acr4 and narfman0. From c8ac32a085d382c43190bda4fb5972e531f501fd Mon Sep 17 00:00:00 2001 From: Timothy Cyrus Date: Fri, 14 Apr 2017 23:13:45 -0400 Subject: [PATCH 19/27] Update README.md (#66) - Changed PNG Badges to SVG - Added Styling to Code Blocks - Added tags for Key Bindings --- README.md | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 647fd6f..d560605 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Tmux Plugin Manager -[![Build Status](https://travis-ci.org/tmux-plugins/tpm.png?branch=master)](https://travis-ci.org/tmux-plugins/tpm) +[![Build Status](https://travis-ci.org/tmux-plugins/tpm.svg?branch=master)](https://travis-ci.org/tmux-plugins/tpm) -Installs and loads TMUX plugins. +Installs and loads `tmux` plugins. Tested and working on Linux, OSX, and Cygwin. @@ -12,54 +12,60 @@ Requirements: `tmux` version 1.9 (or higher), `git`, `bash`. Clone TPM: - $ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +```bash +$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +``` Put this at the bottom of `.tmux.conf`: - # List of plugins - set -g @plugin 'tmux-plugins/tpm' - set -g @plugin 'tmux-plugins/tmux-sensible' +```bash +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' - # Other examples: - # set -g @plugin 'github_username/plugin_name' - # set -g @plugin 'git@github.com/user/plugin' - # set -g @plugin 'git@bitbucket.com/user/plugin' +# Other examples: +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'git@github.com/user/plugin' +# set -g @plugin 'git@bitbucket.com/user/plugin' - # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) - run '~/.tmux/plugins/tpm/tpm' +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' +``` Reload TMUX environment so TPM is sourced: - # type this in terminal if tmux is already running - $ tmux source ~/.tmux.conf +```bash +# type this in terminal if tmux is already running +$ tmux source ~/.tmux.conf +``` That's it! ### Installing plugins 1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` -2. Press `prefix + I` (capital I, as in **I**nstall) to fetch the plugin. +2. Press `prefix` + I (capital I, as in **I**nstall) to fetch the plugin. You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced. ### Uninstalling plugins 1. Remove (or comment out) plugin from the list. -2. Press `prefix + alt + u` (lowercase u as in **u**ninstall) to remove the plugin. +2. Press `prefix` + alt + u (lowercase u as in **u**ninstall) to remove the plugin. All the plugins are installed to `~/.tmux/plugins/` so alternatively you can find plugin directory there and remove it. ### Key bindings -`prefix + I` +`prefix` + I - Installs new plugins from GitHub or any other git repository - Refreshes TMUX environment -`prefix + U` +`prefix` + U - updates plugin(s) -`prefix + alt + u` +`prefix` + alt + u - remove/uninstall plugins not on the plugin list ### More plugins @@ -80,13 +86,15 @@ this: ### Tests -Tests for this project run on [travis](https://travis-ci.org/tmux-plugins/tpm). +Tests for this project run on [Travis CI](https://travis-ci.org/tmux-plugins/tpm). When run locally, [vagrant](https://www.vagrantup.com/) is required. Run tests with: - # within project directory - $ ./run_tests +```bash +# within project directory +$ ./run_tests +``` ### Other goodies From e51a3772b5e312900ea416740e14195df7cf4c22 Mon Sep 17 00:00:00 2001 From: Shou Ya Date: Wed, 2 Aug 2017 12:09:05 +0800 Subject: [PATCH 20/27] solution to the problem 'tpm returned 127' See issue #67 for more discussion --- docs/tpm_not_working.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/tpm_not_working.md b/docs/tpm_not_working.md index 87d2998..bfa14ac 100644 --- a/docs/tpm_not_working.md +++ b/docs/tpm_not_working.md @@ -78,3 +78,19 @@ subdirectories): ```bash find ~/.tmux -type d -name '.git*' -prune -o -type f -print0 | xargs -0 dos2unix ``` + +
+ +> '~/.tmux/plugins/tpm/tpm' returned 127 (on macOS, w/ tmux installed using brew) + +Related: [issue #67](https://github.com/tmux-plugins/tpm/issues/67) + +This problem is because tmux's `run-shell` command runs a shell which doesn't read from user configs, thus tmux installed in `/usr/local/bin` will not be found. + +The solution is to insert the following line: + +``` +set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" +``` + +before any `run-shell`/`run` commands in `~/.tmux.conf`. From 3efe9b20bab501054b08e16c571e44f8e4e13f55 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 2 Sep 2017 08:03:23 +0100 Subject: [PATCH 21/27] correct spelling mistake --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 672d3e7..394758d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ - enable overriding default key bindings - start using `C-c` to clear screen - add uninstall/clean procedure and keybinding (prefix+alt+u) (@chilicuil) -- add new `set @plugin 'repo'` plugin defintion syntax (@chilicuil) +- add new `set @plugin 'repo'` plugin definition syntax (@chilicuil) - 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 From 2c4a2dfd655c13b4e15d693e2c2dba529b1d1c48 Mon Sep 17 00:00:00 2001 From: Thore Weilbier Date: Fri, 2 Nov 2018 13:07:53 +0100 Subject: [PATCH 22/27] Add flexible tmux configuration load function. Add function `_get_user_tmux_conf` to helper script `plugin_functions`. Function is searching for the users tmux configuration on multiple places by a prioritized order. The response is used within`_tmux_conf_contents` to read in the content as normally. Add new environment variable `TMUX_PLUGIN_MANAGER_CONFIG_LOCATION` which is optional to be defined. If so it has the highest priority to be loaded, despite if the file exist or not. XDG directory support has been added as well by the second priority location at `$XDG_CONFIG_HOME/tmux/tmux.conf`. --- scripts/helpers/plugin_functions.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index d2778d5..a757cc5 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -15,8 +15,30 @@ _tpm_path() { _CACHED_TPM_PATH="$(_tpm_path)" +# Get the absolute path to the users configuration file of TMux. +# This includes a prioritized search on different locations. +# +_get_user_tmux_conf() { + # Define the different possible locations. + custom_location="$TMUX_PLUGIN_MANAGER_CONFIG_LOCATION" + xdg_location="$XDG_CONFIG_HOME/tmux/tmux.conf" + default_location="$HOME/.tmux.conf" + + # Search for the correct configuration file by priority. + if [ -n "$custom_location" ]; then + echo "$custom_location" + + elif [ -f "$xdg_location" ]; then + echo "$xdg_location" + + else + echo "$default_location" + fi +} + _tmux_conf_contents() { - cat /etc/tmux.conf ~/.tmux.conf 2>/dev/null + user_config=$(_get_user_tmux_conf) + cat /etc/tmux.conf "$user_config" 2>/dev/null if [ "$1" == "full" ]; then # also output content from sourced files local file for file in $(_sourced_files); do From 206ded75d844915b49f388905421598b5fc2943a Mon Sep 17 00:00:00 2001 From: Thore Weilbier Date: Sun, 4 Nov 2018 11:19:28 +0100 Subject: [PATCH 23/27] Restore tabs instead of spaces for indentation. --- scripts/helpers/plugin_functions.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index a757cc5..44f8e91 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -19,25 +19,25 @@ _CACHED_TPM_PATH="$(_tpm_path)" # This includes a prioritized search on different locations. # _get_user_tmux_conf() { - # Define the different possible locations. - custom_location="$TMUX_PLUGIN_MANAGER_CONFIG_LOCATION" - xdg_location="$XDG_CONFIG_HOME/tmux/tmux.conf" - default_location="$HOME/.tmux.conf" + # Define the different possible locations. + custom_location="$TMUX_PLUGIN_MANAGER_CONFIG_LOCATION" + xdg_location="$XDG_CONFIG_HOME/tmux/tmux.conf" + default_location="$HOME/.tmux.conf" - # Search for the correct configuration file by priority. - if [ -n "$custom_location" ]; then - echo "$custom_location" + # Search for the correct configuration file by priority. + if [ -n "$custom_location" ]; then + echo "$custom_location" - elif [ -f "$xdg_location" ]; then - echo "$xdg_location" + elif [ -f "$xdg_location" ]; then + echo "$xdg_location" - else - echo "$default_location" - fi + else + echo "$default_location" + fi } _tmux_conf_contents() { - user_config=$(_get_user_tmux_conf) + user_config=$(_get_user_tmux_conf) cat /etc/tmux.conf "$user_config" 2>/dev/null if [ "$1" == "full" ]; then # also output content from sourced files local file From a403ca3b67f880fc3ef3f585bae2779932570cf5 Mon Sep 17 00:00:00 2001 From: Ethan Chan Date: Sun, 4 Nov 2018 16:40:07 -0800 Subject: [PATCH 24/27] Update README.md installation instructions. `run '~/.tmux/plugins/tpm/tpm'` should be run in the background, so the `-b` flag was added. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d560605..834a6ff 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible' # set -g @plugin 'git@bitbucket.com/user/plugin' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) -run '~/.tmux/plugins/tpm/tpm' +run -b '~/.tmux/plugins/tpm/tpm' ``` Reload TMUX environment so TPM is sourced: From 0e46b92aba3938d391c21738ab39b7c0ad4fcf2f Mon Sep 17 00:00:00 2001 From: Thore Weilbier Date: Wed, 7 Nov 2018 09:31:21 +0100 Subject: [PATCH 25/27] Remove _CONFIG_LOCATION variable again. It has been decided that this feature should been removed until it will be requested. --- scripts/helpers/plugin_functions.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index 44f8e91..cbd1b55 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -20,15 +20,11 @@ _CACHED_TPM_PATH="$(_tpm_path)" # _get_user_tmux_conf() { # Define the different possible locations. - custom_location="$TMUX_PLUGIN_MANAGER_CONFIG_LOCATION" xdg_location="$XDG_CONFIG_HOME/tmux/tmux.conf" default_location="$HOME/.tmux.conf" # Search for the correct configuration file by priority. - if [ -n "$custom_location" ]; then - echo "$custom_location" - - elif [ -f "$xdg_location" ]; then + if [ -f "$xdg_location" ]; then echo "$xdg_location" else From 42bb2bf48bef881be504278cf5156371b542cf81 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Wed, 7 Nov 2018 12:39:08 +0100 Subject: [PATCH 26/27] Note about XDG dir spec --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 834a6ff..7943d71 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Clone TPM: $ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm ``` -Put this at the bottom of `.tmux.conf`: +Put this at the bottom of `~/.tmux.conf` (`$XDG_CONFIG_HOME/tmux/tmux.conf` +works too): ```bash # List of plugins From 6727ee441d05a1e911c8d25bad162a07dc3cd677 Mon Sep 17 00:00:00 2001 From: Pascal Loth Date: Wed, 20 Feb 2019 15:22:35 +0100 Subject: [PATCH 27/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7943d71..db640bf 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ That's it! ### Installing plugins 1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` -2. Press `prefix` + I (capital I, as in **I**nstall) to fetch the plugin. +2. Press `prefix` + I (capital i, as in **I**nstall) to fetch the plugin. You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced.