A code search tool similar to
the_silver_searcher(ag). It supports multi platforms and multi encodings.
- It searches code about 3–5× faster than
- It searches code as fast as
- It ignores file patterns from your
- It ignores directories with names that start with
--hiddenoption, if you want to search.
- It searches
- It provides binaries for multi platform (macOS, Windows, Linux).
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!!
$ # Recursively searches for PATTERN in current directory. $ pt PATTERN $ # You can specify PATH and some OPTIONS. $ pt OPTIONS PATTERN PATH
If you put configuration file on the following directories, pt use option in the file.
- .ptconfig.toml (current directory)
The file is TOML format like the following.
color = true context = 3 ignore = ["dir1", "dir2"] color-path = "1;34"
The options are same as command line options.
Vim + Unite.vim
You can use pt with Unite.vim.
nnoremap <silent> ,g :<C-u>Unite grep:. -buffer-name=search-buffer<CR> 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
$ go get -u github.com/monochromegane/the_platinum_searcher/...
Download from the following url.
Or, you can use Homebrew (Only macOS).
$ brew install pt
pt is an alias for
the_platinum_searcher in Homebrew.
- Fork it
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...command and confirm that it passes
- Create new Pull Request