Merge branch 'master' into patch-1

This commit is contained in:
Timothy Cyrus 2017-04-14 16:46:02 -04:00 committed by GitHub
commit e29ebdae9f
5 changed files with 55 additions and 14 deletions

View File

@ -35,7 +35,7 @@ run '~/.tmux/plugins/tpm/tpm'
Reload TMUX environment so TPM is sourced: Reload TMUX environment so TPM is sourced:
```bash ```bash
# type this in terminal # type this in terminal if tmux is already running
$ tmux source ~/.tmux.conf $ tmux source ~/.tmux.conf
``` ```

View File

@ -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. 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" \ 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.

View File

@ -2,10 +2,12 @@
Here's the list of issues users had with `tpm`: Here's the list of issues users had with `tpm`:
<hr />
> Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even > Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even
defined. 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`?<br/> - Do you have required `tmux` version to run `tpm`?<br/>
Check `tmux` version with `$ tmux -V` command and make sure it's higher or 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.<br/> - ZSH tmux plugin might be causing issues.<br/>
If you have it installed, try disabling it and see if `tpm` works then. If you have it installed, try disabling it and see if `tpm` works then.
<hr />
> Help, I'm using custom config file with `tmux -f /path/to/my_tmux.conf` > 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!? 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. `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 The solution is to use alternative plugin definition syntax. Here are the steps
@ -40,15 +44,37 @@ to make it work:
The plugins should now be working. The plugins should now be working.
<hr />
> Weird sequence of characters show up when installing or updating plugins > 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) - This could be caused by [tmuxline.vim](https://github.com/edkolev/tmuxline.vim)
plugin. Uninstall it and see if things work. plugin. Uninstall it and see if things work.
<hr />
> "failed to connect to server" error when sourcing .tmux.conf > "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`. - Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`.
<hr />
> 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
```

View File

@ -28,12 +28,25 @@ _tmux_conf_contents() {
# return files sourced from tmux config files # return files sourced from tmux config files
_sourced_files() { _sourced_files() {
_tmux_conf_contents | _tmux_conf_contents |
awk '/^ *source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' 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 # PUBLIC FUNCTIONS BELOW
tpm_path() { 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" echo "$_CACHED_TPM_PATH"
} }
@ -43,7 +56,7 @@ tpm_plugins_list_helper() {
# read set -g @plugin "tmux-plugins/tmux-example-plugin" entries # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries
_tmux_conf_contents "full" | _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: # Allowed plugin name formats:

View File

@ -27,7 +27,6 @@ pull_changes() {
update() { update() {
local plugin="$1" local plugin="$1"
echo_ok "Updating \"$plugin\""
$(pull_changes "$plugin" > /dev/null 2>&1) && $(pull_changes "$plugin" > /dev/null 2>&1) &&
echo_ok " \"$plugin\" update success" || echo_ok " \"$plugin\" update success" ||
echo_err " \"$plugin\" update fail" echo_err " \"$plugin\" update fail"
@ -41,9 +40,10 @@ update_all() {
local plugin_name="$(plugin_name_helper "$plugin")" local plugin_name="$(plugin_name_helper "$plugin")"
# updating only installed plugins # updating only installed plugins
if plugin_already_installed "$plugin_name"; then if plugin_already_installed "$plugin_name"; then
update "$plugin_name" update "$plugin_name" &
fi fi
done done
wait
} }
update_plugins() { update_plugins() {
@ -51,14 +51,16 @@ update_plugins() {
for plugin in $plugins; do for plugin in $plugins; do
local plugin_name="$(plugin_name_helper "$plugin")" local plugin_name="$(plugin_name_helper "$plugin")"
if plugin_already_installed "$plugin_name"; then if plugin_already_installed "$plugin_name"; then
update "$plugin_name" update "$plugin_name" &
else else
echo_err "$plugin_name not installed!" echo_err "$plugin_name not installed!" &
fi fi
done done
wait
} }
main() { main() {
ensure_tpm_path_exists
if [ "$1" == "all" ]; then if [ "$1" == "all" ]; then
update_all update_all
else else