• Stars
    star
    2,789
  • Rank 15,649 (Top 0.4 %)
  • Language
    Go
  • License
    MIT License
  • Created over 10 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.

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

More Repositories

1

go_design_pattern

Design patterns in Golang.
Go
1,469
star
2

argen

An ORM code-generation tool for Go, provides ActiveRecord-like functionality for your types.
Go
195
star
3

kaburaya

Kaburaya optimize the number of goroutines by feedback control.
Go
105
star
4

smux

smux is a socket multiplexer written in Golang. It provides fast communication by efficiently a single connection.
Go
100
star
5

hoi

An easy file/message transfer tool using http file server.
Go
99
star
6

mdt

A markdown table generation tool from CSV/TSV.
Go
92
star
7

dragon-imports

A tool for speedup goimports command 🐉
Go
63
star
8

LGTM

This is a Chrome Extension for LGTM.in/g. You can spice up your LGTM comments by this extension.
JavaScript
63
star
9

go-gitignore

A fast gitignore matching library for Go.
Go
61
star
10

gannoy

Approximate nearest neighbor search server and dynamic index written in Golang.
Go
40
star
11

torokko

A build proxy server using Docker container for Golang apps.
Go
31
star
12

go-avx

AVX(Advanced Vector Extensions) binding for golang.
Go
30
star
13

conflag

A combination command-line flag and configuration file library for Go.
Go
29
star
14

vagrant-global-status

A fast vagrant global-status command.
Go
13
star
15

go-bincode

A tool for embedding Go code in a Go binary using go-bindata.
Go
13
star
16

smartsifter

SmartSifter (On-line outlier detection) by Golang.
Go
12
star
17

starchart

StarChart is a tool to manage Google Cloud Machine Learning training programs and model versions.
Python
12
star
18

slack-incoming-webhooks

A Slack Incoming Webhooks client in Go.
Go
11
star
19

vagrant-peco

A peco tool for vagrant-global-status.
Shell
10
star
20

dotfiles

my dotfiles
Vim Script
10
star
21

be_strong

Strong parameter converter.
Ruby
9
star
22

stage

Simple and flexible simulation framework for Go.
Go
9
star
23

pendulum

Pendulum is a tool to manage Treasure Data scheduled jobs.
Ruby
9
star
24

mruby-tensorflow

TensorFlow class for mruby.
C++
7
star
25

BundleSaver

Android用ユーティリティ。 BundleまたはPreferenceに対するActivity状態の保存/復元を自動化してくれます。
Java
6
star
26

kaleidoscope

[WIP] Distributed peer-to-peer personal key-value store.
Go
6
star
27

go-code-embedding

A tool to embed Go source code into binary using go:embed.
Go
6
star
28

gradient_descent

The sample implementaion of gradient descent in Golang.
Go
6
star
29

QueryBuilder

A very simple query builder for PHP. It helps building query and binding values.
PHP
5
star
30

hugo-theme-thinking-megane

My blog theme for Hugo. Designed by keita_kawamoto. http://blog.monochromegane.com
HTML
5
star
31

synapse

Distributed, RESTful, Plugable Matching Engine.
Go
4
star
32

mruby-secure-random

SecureRandom class for mruby.
Ruby
4
star
33

dsn

A data source name adapter for sql.Open in golang.
Go
4
star
34

active_hash-like

Custom matcher for ActiveHash. It provides `like` operator.
Ruby
4
star
35

guardian

Monitor file changes and execute custom commands for each event.
Go
4
star
36

mruby-time-strftime

Time#strftime for mruby.
Ruby
4
star
37

flagen

A command line option parser generator using command line option.
Go
4
star
38

mackerel-plugin-delayed-job-count

delayed_job custom metrics plugin for mackerel.io agent.
Go
4
star
39

sanny

Scalable Approximate Nearest Neighbors in Golang optimized for embedding vectors.
Go
4
star
40

exponential-histograms

Exponential histograms is a data structure for sliding windows. It is from `Maintaining Stream Statistics over Sliding Windows, M.Datar, A.Gionis, P.Indyk, R.Motwani; ACM-SIAM, 2002`.
Go
4
star
41

mysql_dump_slow

A library to summarize MySQL slow_log records in Ruby.
Ruby
3
star
42

monochromegane.github.com

Thinking-megane - Ruby, Vim, Java, Android に関する情報を公開していくGithub Pagesです
HTML
3
star
43

retrospective-anchoco

ふりかえりのファシリテーターを行うときに使える"あんちょこ"です。
Ruby
3
star
44

banditsflow

🎰 A building workflow and tracking its information framework for bandits.
Python
3
star
45

active_hash-kaminari

Use kaminari paginator with ActiveHash.
Ruby
3
star
46

terminal

This is Go package that provides function like a "isatty()".
Go
2
star
47

kirakira

This is Cinch plugin that convert message to rainbow.
Ruby
2
star
48

queuing-theory-simulator

Queuing theory simulator in Go.
Go
2
star
49

go-ngt

NGT binding for golang.
Go
2
star
50

conference-proposals

My talk proposals.
2
star
51

ssd_mlengine

Port of SSD: Single Shot MultiBox Detector to Google Cloud Machine Learning Engine.
Python
2
star
52

go-whois

WHOIS client in Go
Go
2
star
53

treasure_hunter

CLI to manage query of Treasure Data command line tool.
Ruby
2
star
54

thinking-megane

My blog contents for Hugo. http://blog.monochromegane.com
2
star
55

adwin

Adwin is an adaptive windowing algorithm. It is from `Learning from time-changing data with adaptive windowing, Bifet, Albert, and Ricard Gavalda; Proceedings of the 2007 SIAM international conference on data mining. Society for Industrial and Applied Mathematics, 2007`.
Go
2
star
56

mole

Get all list of Go modules.
Go
1
star
57

postman

Go
1
star
58

ship-it

A simple deploy tool in Go. It's suitable for golang project.
Go
1
star
59

mruby-sidekiq-client

Sidekiq Client class for mruby.
Ruby
1
star
60

homebrew-pt

Ruby
1
star
61

mruby-annoy

AnnoyIndex class for mruby.
C++
1
star
62

thor_hammer

ThorHammer provides web api for your Thor CLI.
Ruby
1
star
63

go-home

A utility for getting home directory in Golang.
Go
1
star
64

sifter

[WIP] A lightweight index for full text search tools using bloom filter.
Go
1
star
65

unite-yaml

unite-yaml is a unite.vim's source which provides candidates for yaml.
Vim Script
1
star
66

homebrew-hoi

Ruby
1
star
67

go-embedding-accessor

An accessor generator for files embedded with go:embed.
Go
1
star