The Platinum Searcher

一个类似于 ack 和 the_silver_searcher(ag) 的代码搜索工具。它支持多平台和多编码。「A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.」

  • 所有者: monochromegane/the_platinum_searcher
  • 平台: Linux, Mac, Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

The Platinum Searcher Build Status wercker status

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

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

$ # 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.

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.

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

You can use pt with pt.el, which can be installed from MELPA.

Installation

Developer

$ go get -u github.com/monochromegane/the_platinum_searcher/...

User

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.

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

Author

monochromegane

概覽

名稱與所有者monochromegane/the_platinum_searcher
主編程語言Go
編程語言Go (語言數: 1)
平台Linux, Mac, Windows
許可證MIT License
發布數30
最新版本名稱v2.2.0 (發布於 )
第一版名稱v1.6.1 (發布於 )
創建於2014-01-02 13:43:20
推送於2023-08-01 10:12:42
最后一次提交2018-09-05 23:00:37
星數2.8k
關注者數73
派生數139
提交數480
已啟用問題?
問題數116
打開的問題數39
拉請求數68
打開的拉請求數7
關閉的拉請求數25
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?
去到頂部