Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- Change the default filter to fzf
- Add percol support
  • Loading branch information
decors committed May 2, 2016
1 parent 5c6306c commit e07373e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ fisher install decors/fish-ghq

## Keybinding

- Ctrl-g: repository finder using [peco] or [fzf]
- Ctrl-g: repository finder using [fzf], [peco] or [percol].

## Variables

### `GHQ_FILTER`

If you use [fzf], run `set -U GHQ_FILTER fzf`.
Default filter is peco if variable is not set.
If you want to change filter, run `set -U GHQ_FILTER peco (or percol)`.
Default filter is fzf if variable is not set.

## Completions

Expand All @@ -41,3 +41,4 @@ Default filter is peco if variable is not set.

[peco]:https://github.com/peco/peco
[fzf]:https://github.com/junegunn/fzf
[percol]:https://github.com/mooz/percol
10 changes: 0 additions & 10 deletions functions/__ghq_filter.fish

This file was deleted.

8 changes: 0 additions & 8 deletions functions/__ghq_filter_fzf.fish

This file was deleted.

8 changes: 0 additions & 8 deletions functions/__ghq_filter_peco.fish

This file was deleted.

15 changes: 15 additions & 0 deletions functions/__ghq_search.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function __ghq_search -d 'Repository search'
set -q GHQ_FILTER; or set -l GHQ_FILTER fzf
set -l query (commandline -b)
switch "$GHQ_FILTER"
case peco fzf percol
test -n "$query"; and set flags --query="$query"; or set flags
ghq list --full-path | eval "$GHQ_FILTER" $flags | read -l select
if [ $select ]
builtin cd "$select"
end
case \*
printf "\nERROR: plugin-ghq is not support '$GHQ_FILTER'.\n"
end
commandline -f repaint
end
4 changes: 2 additions & 2 deletions key_bindings.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bind \cg '__ghq_filter'
bind \cg '__ghq_search'
if bind -M insert > /dev/null ^ /dev/null
bind -M insert \cg '__ghq_filter'
bind -M insert \cg '__ghq_search'
end

0 comments on commit e07373e

Please sign in to comment.