vgrep

A pager for grep http://github.com/fmthoma/vgrep#readme

Latest on Hackage:0.2.1.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Franz Thoma

vgrep -- A pager for grep

Screenshot

Usage

  • As a pager:

    `bash grep -rn data /some/path | vgrep # -n for line numbers `

  • As a drop-in replacement for grep:

    `bash vgrep data /some/path # recursive by default vgrep data /some/path | vgrep default # works with pipes, too `

  • With a git alias defined in your ~/.gitconfig:

    `bash git config --global alias.vgrep '!__git_vgrep () { git grep --color=always "$@" | vgrep; }; __git_vgrep' git vgrep data `

  • Using ack/ag instead of grep? No problem:

    `bash ack data | vgrep # Output of `ack` is compatible ack --color data | vgrep # Even coloring works ag --color data | vgrep # Same for `ag` `

Keybindings:

  • Use hjkl or the arrow keys to navigate
  • Enter opens a pager with the selected file
  • e opens the selected file in $EDITOR
  • Tab switches between results list and pager
  • q closes the pager and then the entire application.

Installation

Binaries

Debian/Ubuntu: .deb files are available for the latest release.

wget https://github.com/fmthoma/vgrep/releases/download/v0.2/vgrep_0.2.0.0-1_amd64.deb
sudo dpkg -i vgrep_0.2.0.0-1_amd64.deb

From Hackage

Installation from Hackage via stack is recommended:

stack update
stack install vgrep

This will install vgrep to your ~/.local/bin directory.

From source

git clone https://github.com/fmthoma/vgrep.git
cd vgrep
stack setup
stack install

Changes

Changelog

v0.2.1

  • Add support for aeson 1.x to enable build with Stackage LTS 9.x
  • Add less-like keybindings Ctrl-u, Ctrl-d (half-page-up/down, only in pager) and Ctrl-b, Ctrl-f (full-page-up/down).

v0.2

  • Added support for a config file: A YAML file located at ~/.vgrep/config.yaml is recognized as configuration file for colors, keybindings and other settings. The default config file can be produced using vgrep --dump-default-config > ~/.vgrep/config.yaml.
  • Added support for colorized input (ANSI CSI/SGR escape codes). vgrep can now be used together wit grep --color=always (and git grep --color=always), which is now enabled by default when using vgrep as drop-in replacement for grep.

v0.1.4.1

  • Switch to strict Text
  • Less dependent on template-haskell

v0.1.4

  • User events (like key events) now have priority over other events, the UI does not block any more.
  • --help and --version now produce sensible output.

v0.1.3

  • Fix pageUp in Results view

v0.1.2

  • Performance improvements
  • Tests for Pager and Results widget
  • Haddock documentation

v0.1.1

  • Fixed j/k keys in pager view
  • Additional h/l// keybindings for horizontal scrolling in pager
  • Matching lines are now highlighted in pager view

v0.1

comments powered byDisqus