Skip to content

rubikitch/pgrepper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pgrepper: (Peco|Powerful|Parallel) Grepper

(Peco|Powerful|Parallel) Grepper

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

Feature

  • 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

Depend on

Pgrepper uses external commands.

  • Ruby
  • zsh
  • grep
  • cmigemo (optional)
  • nkf (optional)

Installation

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

Sample

Sample peco configuration

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"
    }
}

Sample helm command

(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")))))))

What commands does pgrepper call?

`pgrepper -n’ shows zsh command line, then you can understand what is going on. See pgrepper-test.sxmp

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages