Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/monochromegane/the_platinum_searcher
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.
https://github.com/monochromegane/the_platinum_searcher
golang
Last synced: 2 days ago
JSON representation
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.
- Host: GitHub
- URL: https://github.com/monochromegane/the_platinum_searcher
- Owner: monochromegane
- License: mit
- Created: 2014-01-02T13:43:20.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-08-01T10:12:42.000Z (over 1 year ago)
- Last Synced: 2025-01-16T19:16:38.625Z (9 days ago)
- Topics: golang
- Language: Go
- Homepage:
- Size: 1.43 MB
- Stars: 2,811
- Watchers: 72
- Forks: 141
- Open Issues: 45
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - the_platinum_searcher - A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings. (Go)
README
# The Platinum Searcher [![Build Status](https://travis-ci.org/monochromegane/the_platinum_searcher.svg?branch=master)](https://travis-ci.org/monochromegane/the_platinum_searcher) [![wercker status](https://app.wercker.com/status/59ef90ac217537abc0994546958037f3/s/master "wercker status")](https://app.wercker.com/project/bykey/59ef90ac217537abc0994546958037f3)
A code search tool similar to `ack` and `the_silver_searcher(ag)`. It supports multi platforms and multi encodings.
## Features
- It searches code about 3–5× faster than `ack`.
- It searches code as fast as `the_silver_searcher(ag)`.
- It ignores file patterns from your `.gitignore`.
- It ignores directories with names that start with `.`, eg `.config`. Use `--hidden` option, if you want to search.
- It searches `UTF-8`, `EUC-JP` and `Shift_JIS` files.
- It provides binaries for multi platform (macOS, Windows, Linux).### Benchmarks
```sh
cd ~/src/github.com/torvalds/linux
ack EXPORT_SYMBOL_GPL 30.18s user 2.32s system 99% cpu 32.613 total # ack
ag EXPORT_SYMBOL_GPL 1.57s user 1.76s system 311% cpu 1.069 total # ag: It's faster than ack.
pt EXPORT_SYMBOL_GPL 2.29s user 1.26s system 358% cpu 0.991 total # pt: It's faster than ag!!
```## Usage
```sh
$ # Recursively searches for PATTERN in current directory.
$ pt PATTERN$ # You can specify PATH and some OPTIONS.
$ pt OPTIONS PATTERN PATH
```## Configuration
If you put configuration file on the following directories, pt use option in the file.
- $XDG\_CONFIG\_HOME/pt/config.toml
- $HOME/.ptconfig.toml
- .ptconfig.toml (current directory)The file is TOML format like the following.
```toml
color = true
context = 3
ignore = ["dir1", "dir2"]
color-path = "1;34"
```The options are same as command line options.
## Editor Integration
### Vim + Unite.vim
You can use pt with [Unite.vim](https://github.com/Shougo/unite.vim).
```vim
nnoremap ,g :Unite grep:. -buffer-name=search-buffer
if executable('pt')
let g:unite_source_grep_command = 'pt'
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_grep_encoding = 'utf-8'
endif
```### Emacs + pt.el
You can use pt with [pt.el](https://github.com/bling/pt.el), which can be installed from [MELPA](http://melpa.milkbox.net/).
## Installation
### Developer
```sh
$ go get -u github.com/monochromegane/the_platinum_searcher/...
```### User
Download from the following url.
- [https://github.com/monochromegane/the_platinum_searcher/releases](https://github.com/monochromegane/the_platinum_searcher/releases)
Or, you can use Homebrew (Only macOS).
```sh
$ brew install pt
````pt` is an alias for `the_platinum_searcher` in Homebrew.
## Contribution
1. Fork it
2. Create a feature branch
3. Commit your changes
4. Rebase your local changes against the master branch
5. Run test suite with the `go test ./...` command and confirm that it passes
6. Run `gofmt -s`
7. Create new Pull Request## License
[MIT](https://github.com/monochromegane/the_platinum_searcher/blob/master/LICENSE)
## Author
[monochromegane](https://github.com/monochromegane)