From c9d7527667977ce31d9f10b2b58f683afc6a1355 Mon Sep 17 00:00:00 2001 From: bootleq Date: Sun, 5 Jun 2016 11:24:25 +0800 Subject: [PATCH 1/4] Fix install script not prepend path to source Seems previous here-doc syntax is broken, now use simple string instead. --- install.zsh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/install.zsh b/install.zsh index ceaf69a..2a07c54 100755 --- a/install.zsh +++ b/install.zsh @@ -26,10 +26,6 @@ if ! [[ -f "$install_dir"gitdiffall.zsh ]]; then exit 1 fi -local txt="$(<<__AUTO_INSERT__ -# auto insert by install.zsh {{{ -[[ -z "\$script_dir" ]] && local script_dir=$install_dir -# }}} auto insert by install.zsh\n -__AUTO_INSERT__)" +local txt='[[ -z "$script_dir" ]] && local script_dir='$install_dir' # auto inserted by install.zsh\n ' echo -e $txt|cat - "$install_dir"gitdiffall.zsh > /tmp/out && mv /tmp/out "$install_dir"gitdiffall.zsh From 63e9cc439a3d7e14e7eb950a93eccc038baee466 Mon Sep 17 00:00:00 2001 From: bootleq Date: Sun, 5 Jun 2016 12:08:12 +0800 Subject: [PATCH 2/4] Improve script location detection Assume '.rb' file is located with '.zsh' file by default. This avoids extra setting of script dir. --- bin/gitdiffall.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/gitdiffall.zsh b/bin/gitdiffall.zsh index 292c4af..5604d7a 100755 --- a/bin/gitdiffall.zsh +++ b/bin/gitdiffall.zsh @@ -1,8 +1,6 @@ -if [[ -z "$script_dir" ]]; then - local script_dir=$HOME/bin/ -fi - function gitdiffall () { + [[ -z "$script_dir" ]] && local script_dir=${${(%):-%x}:h}/ + if [[ "$#" -eq 1 && "$1" =~ "^(j|k|@.+|[0-9]+)$" ]]; then local parsed shortcut revision msg parsed="`ruby ${script_dir}gitdiffall.rb $*`" From e8f29cf2116f89ec3487e70003f06b7def1ec430 Mon Sep 17 00:00:00 2001 From: bootleq Date: Sun, 5 Jun 2016 12:24:05 +0800 Subject: [PATCH 3/4] Add zplug install instruction to README --- README.md | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 12c1d8d..8f5181e 100644 --- a/README.md +++ b/README.md @@ -3,26 +3,38 @@ gitdiffall View git diff in Vim tabs. -- `gitdiffall` command for zsh (**requires ruby** for running _gitdiffall.rb_). +- `gitdiffall` function for zsh (**requires ruby** for running _gitdiffall.rb_). - `GitDiff`, `GitDiffInfo`, `GitDiffOff` commands for Vim. Install ======= -1. Install like general Vim plugins. -2. Execute _install.zsh_ (will ask you for copying scripts). -3. Source _path/to/gitdiffall.zsh_ in your _.zshrc_. +Install like general Vim plugins. -```zsh -if [ -e ~/some_dir/gitdiffall.zsh ]; then - source ~/some_dir/gitdiffall.zsh -fi -``` + +## Install Zsh Helper Function + +- With [zplug][] + + ```zsh + zplug "bootleq/vim-gitdiffall", use:"bin/*.zsh" + ``` + +- Manual install + + 1. Execute _install.zsh_ (will ask you for copying scripts to path). + 2. Source _path/to/gitdiffall.zsh_ in your _.zshrc_. + + ```zsh + if [ -e ~/some_dir/gitdiffall.zsh ]; then + source ~/some_dir/gitdiffall.zsh + fi + ``` -Usage -===== +Zsh Function Usage +================== In zsh, use `gitdiffall` to open git diff in Vim tabs, examples: @@ -46,8 +58,8 @@ For convenience, some special notations are available: During merge conflicts, `gitdiffall` will open a 3-way diff in Vim. -Configuration -============= +Zsh Function Configuration +========================== gitdiffall.rb takes configure file from one of the following: @@ -94,3 +106,4 @@ bind -t vi-copy > copy-pipe "~/.tmux-in.rb gitdiffall" [tmux-in.rb]: https://gist.github.com/bootleq/786cb41a8072e537467e +[zplug]: http://zplug.sh/ From cd21da5c81ddf5f3c547ec9a285037e582f323ab Mon Sep 17 00:00:00 2001 From: bootleq Date: Sun, 5 Jun 2016 12:48:21 +0800 Subject: [PATCH 4/4] Zplug installation is the preferred way --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f5181e..9c2de6d 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ Install like general Vim plugins. ## Install Zsh Helper Function -- With [zplug][] +- With [zplug][] (preferred way) ```zsh zplug "bootleq/vim-gitdiffall", use:"bin/*.zsh" ``` -- Manual install +- or Manual install 1. Execute _install.zsh_ (will ask you for copying scripts to path). 2. Source _path/to/gitdiffall.zsh_ in your _.zshrc_.