├── LICENSE
├── README.md
└── functions
├── peco_kill.fish
└── peco_select_history.fish
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Bruno Ferreira Pinto
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # peco
4 |
5 | [](/LICENSE)
6 | [](http://fishshell.com)
7 | [](https://www.github.com/oh-my-fish/oh-my-fish)
8 |
9 |
10 |
11 | Use [peco][peco] with [fish shell][fish-shell] managed by [Oh my
12 | fish][omf-link] in a very simple way!
13 |
14 | Based directly on the percol plugin.
15 |
16 | ## Installation
17 |
18 | ```fish
19 | omf install peco
20 | ```
21 |
22 | ## Usage
23 |
24 | Please bind `peco_select_history` to your favorite key.
25 |
26 | If you'd like to bind Ctrl+r:
27 |
28 | ```fish
29 | function fish_user_key_bindings
30 | bind \cr 'peco_select_history (commandline -b)'
31 | end
32 | ```
33 |
34 | # License
35 |
36 | [MIT][mit] © [Oh My Fish! Authors][author] et [al][contributors]
37 |
38 |
39 | [mit]: http://opensource.org/licenses/MIT
40 | [author]: https://github.com/oh-my-fish/plugin-peco/blob/master/LICENSE
41 | [contributors]: https://github.com/oh-my-fish/plugin-peco/graphs/contributors
42 | [omf-link]: https://github.com/oh-my-fish/oh-my-fish
43 | [fish-shell]: https://fishshell.com
44 | [peco]: https://github.com/peco/peco
45 |
46 | [license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
47 |
--------------------------------------------------------------------------------
/functions/peco_kill.fish:
--------------------------------------------------------------------------------
1 | function peco_kill
2 | ps ax -o pid,time,command | peco --query "$LBUFFER" | awk '{print $1}' | xargs kill
3 | end
4 |
--------------------------------------------------------------------------------
/functions/peco_select_history.fish:
--------------------------------------------------------------------------------
1 | function peco_select_history
2 | if test (count $argv) = 0
3 | set peco_flags --layout=bottom-up
4 | else
5 | set peco_flags --layout=bottom-up --query "$argv"
6 | end
7 |
8 | history|peco $peco_flags|read foo
9 |
10 | if [ $foo ]
11 | commandline $foo
12 | else
13 | commandline ''
14 | end
15 | end
16 |
--------------------------------------------------------------------------------