This tiny Ruby script enables narrowing by multiple grep(s). It aims to enhance peco as a custom filter, but you can use it anywhere. It is based on searcher of Emacs’s incremental completion and selection narrowing framework, helm (helm-multi-match) and anything (anything-match-plugin).
Demo:Eijiro (huge English-Japanese dictionary) search by pgrepper
- Very small. Only a wrapper to zsh
- Show zsh command line
- Use any searcher for first query (e.g. sary, csearch, etc)
- Migemo feature by cmigemo
- Word search
Pgrepper uses external commands.
- Ruby
- zsh
- grep
- cmigemo (optional)
- nkf (optional)
Pgrepper is single script, so you can install it easily.
$ wget -O ~/bin/pgrepper https://raw.githubusercontent.com/rubikitch/pgrepper/master/pgrepper $ chmod +x ~/bin/pgrepper
My peco configuration file (~/.config/peco/config.json)
{ "CustomFilter": { "eijiro": { "Cmd": "/r/src/pgrepper/pgrepper", "Args": ["--searcher=sary -i", "--fold=90", "--dummy=no", "$QUERY", "/log2/sary/eijiro.all.utf8.txt"] }, "default": { "Cmd": "/r/src/pgrepper/pgrepper", "Args": ["$QUERY", "--dummy=last"], "BufferThreshold": 10000 }, "migemo": { "Cmd": "/r/src/pgrepper/pgrepper", "Args": ["--migemo", "$QUERY", "--dummy=last"], "BufferThreshold": 100000 }, "filelist": { "Cmd": "/r/src/pgrepper/pgrepper", "Args": ["--dummy=first", "$QUERY", "/tmp/.recentf", "/log2/sary/all.filelist"], "BufferThreshold": 100000 } }, "SingleKeyJump": { "ShowPrefix": true }, "Keymap": { "@": "peco.ToggleSingleKeyJump", "C-g": "peco.Cancel", "C-v": "peco.ScrollPageDown", "M-v": "peco.ScrollPageUp", "C-f": "peco.ScrollRight", "C-b": "peco.ScrollLeft", "M-a": "peco.SelectAll", "Pgup": "peco.ScrollPageUp", "Pgdn": "peco.ScrollPageDown", "C-l": "peco.RefreshScreen", "C-d": "peco.DeleteBackwardWord", "C-k": "peco.DeleteAll", "C-u": "peco.DeleteAll" } }
(defun peco-pgrepper-sample ()
(interactive)
(helm :sources '(((name . "pgrepper sample")
(candidates-process
. (lambda ()
(start-process "pgrepper" nil
"/r/src/pgrepper/pgrepper" helm-pattern
"/r/.emacs.d/init.el")))))))
`pgrepper -n’ shows zsh command line, then you can understand what is going on. See pgrepper-test.sxmp