Skip to content

Commit

Permalink
Merge branch 'zplug'
Browse files Browse the repository at this point in the history
* zplug:
  Zplug installation is the preferred way
  Add zplug install instruction to README
  Improve script location detection
  Fix install script not prepend path to source
  • Loading branch information
bootleq committed Jun 5, 2016
2 parents 54e1d6c + cd21da5 commit ff65f7b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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][] (preferred way)

```zsh
zplug "bootleq/vim-gitdiffall", use:"bin/*.zsh"
```

- or 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:

Expand All @@ -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:

Expand Down Expand Up @@ -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/
6 changes: 2 additions & 4 deletions bin/gitdiffall.zsh
Original file line number Diff line number Diff line change
@@ -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 $*`"
Expand Down
6 changes: 1 addition & 5 deletions install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ff65f7b

Please sign in to comment.