Skip to content

Commit

Permalink
Improve README.md.
Browse files Browse the repository at this point in the history
- Add Arch Linux installation instructions.
- Add Mac OS X installation instructions.
- Add screencast.
- Add Vim usage instructions.
- Add instructions for checking the signature.

Closes #34.
  • Loading branch information
calleluks committed Feb 27, 2015
1 parent e603a64 commit f244285
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 6 deletions.
75 changes: 69 additions & 6 deletions README.md
@@ -1,24 +1,87 @@
# Pick

![pick(1) usage](screencast.gif)

The `pick(1)` utility allows users to choose one option from a set of choices
using an interface with fuzzy search functionality.

## Installation

1. Download the latest release from [the releases page] and extract the archive:
### Arch Linux

A package for Pick is available in [the AUR].

```sh
wget https://aur.archlinux.org/packages/pi/pick/pick.tar.gz
tar -xzf pick.tar.gz
cd pick
makepkg -s
pacman -U pick-VERSION-x86_64.pkg.tar.xz
```

### Mac OS X via Homebrew

```sh
brew tap thoughtbot/formulae
brew install pick
```

### From source

1. Download the latest release from [the releases page], optionally check the
signature and extract the archive:

tar -zxvf pick-VERSION.tar.gz
```sh
wget https://github.com/thoughtbot/pick/releases/download/vVERSION/pick-VERSION.tar.gz
wget https://github.com/thoughtbot/pick/releases/download/vVERSION/pick-VERSION.tar.gz.asc
gpg --verify pick-VERSION.tar.gz.asc
tar -xzf pick-VERSION.tar.gz
```

2. Follow the bundled installation instructions:

cd pick-VERSION
less INSTALL.md
```sh
cd pick-VERSION
less INSTALL.md
```

[the releases page]: https://github.com/thoughtbot/pick/releases
[the AUR]: https://aur.archlinux.org/packages/pick/
[the releases page]: https://github.com/thoughtbot/pick/releases/

## Usage

See the `pick(1)` man page for usage instructions and examples.
`pick(1)` reads a list of choices on `stdin` and outputs the selected choice on
`stdout`. Therefore it is easily used both in pipelines and subshells:

```sh
git ls-files | pick | xargs less # Select a file in the current git repository to view in less
cd $(find . -type d | pick) # Select a directory to cd into
```

Pick can also easily be used from within Vim with this VimL function:

```viml
function! PickCommand(choice_command, pick_args, vim_command)
try
let selection = system(a:choice_command . " | ./src/pick" . a:pick_args)
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from pick on the screen
redraw!
return
endtry
redraw!
exec a:vim_command . " " . selection
endfunction
```

Then map keys to call this function:

```viml
nnoremap <leader>e :call PickCommand("git ls-files", "", ":e")<cr>
```

See the `pick(1)` man page for detailed usage instructions and more examples.

## Copyright

Expand Down
Binary file added screencast.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f244285

Please sign in to comment.