]> Sergey Matveev's repositories - path-extractor.git/blob - README.md
4a5ef4943ef9942dfa5a3302cec9f004ca95e3b9
[path-extractor.git] / README.md
1 # PathExtractor (pe)
2
3 ![demo](https://raw.github.com/edi9999/i/master/demo.gif)
4
5 PathExtractor is a command line tool that extracts a list of files/paths from stdin.
6
7 Advantages over [fpp](https://github.com/facebook/PathPicker):
8
9  * It does only one thing : more unixy
10  * You can use it with any fuzzy finder, such as [fzf](https://github.com/junegunn/fzf),[peco](https://github.com/peco/peco),[percol](https://github.com/mooz/percol),[pick](https://github.com/thoughtbot/pick),[selecta](https://github.com/garybernhardt/selecta/)
11  * It doesn't wait for stdin to be finished to output the paths
12  * It is faster
13  * It is much smaller (easily understandable)
14  * You can also use it without a fuzzy finder for programmatic usage
15
16 For example, you could write:
17
18     git status | pe
19
20 to get a list of the files that were added/changed, without all the formating
21
22 One of the most common usage is to create an alias that will automatically run :
23
24   `pe` + a command line fuzzy finder such as fzf + an action such as opening that file in your favorite editor.
25
26 For example, using `zsh` , I have as an alias:
27
28     alias -g P='| pe | fzf | read filename; [ ! -z $filename ] && vim $filename'
29
30 With `bash`:
31
32     bind '"PP": "| pe | uniq | fzf | while read filename; do [ ! -z $filename ] && </dev/tty vim $filename; done\n'
33
34 So that If I run
35
36     `git status P`
37
38 or
39
40     `git status PP`
41
42 to quickly open one of the changed files in vim
43
44 Other usage ideas:
45
46 With zsh:
47
48     # Copy selected path to clipboard
49     alias -g C='| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c'
50
51 With bash:
52
53     bind '"CC": "| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c\n"'
54
55 # Installation
56
57 ```
58 git clone # in your go path
59 go test
60 go build
61 go install
62 ```