Giter Club home page Giter Club logo

vim-bettergrep's Introduction

vim-bettergrep

A better way to grep in vim.

The purpose of this plugin is to provide a lightweight and enhanced version of the original :grep family of Vim commands.

This plugin implements RomainL's Instant grep + quickfix with a few of my own additions.

  • Abbreviates :grep with :Grep, as well as the rest: :lgrep, :grepadd, lgrepadd
  • In general faster than regular :grep
  • Autoconfigures the grep program based on what you have in your PATH in the following order:
  • Asynchronous grepping.
  • <C-g> in normal mode mapping to :Grep in command mode.

Installation

With vim-plug:

Plug 'qalshidi/vim-bettergrep'

Usage

Either type :grep or press <C-g> and start searching your files :).

Demonstration

Configuration

Don't map my CTRL-G!

let g:bettergrep_no_mappings = 1

I want to use some_grepper!

let g:bettergrepprg = "<some_grepper>"

I want to use git grep!

let g:bettergrepprg = "git grep --column -n"
" or using tpope/vim-fugitive plugin's :Ggrep

I want to use git grep when my current directory is a git repository!

autocmd VimEnter * if isdirectory('./.git') | let g:bettergrepprg = 'git grep -n --column' | endif
if exists('##DirChanged')
  autocmd DirChanged * if isdirectory('./.git') | let g:bettergrepprg = 'git grep -n --column' | endif
endif

Don't abbreviate my :grep!

let g:bettergrep_no_abbrev = 1

It is not ignoring my hidden files/.gitignore files!

Frequently Asked Questions

How do I grep a pattern with spaces?

  • Try enclosing your pattern in single quotes like this:
:Grep 'my pattern' my/file/path

How is this different from vim-grepper?

  • vim-bettergrep is a lightweight enhancement to :grep and tries to imitate the original Vim commands. To me, it seems vim-grepper is beefier and its own beast, allowing multiple grep commands and loading everything at start up as opposed to using Vim's autoload feature. They both have their own use cases. I am happy with original Vim's grep and don't necessarily need more than that.

How is this different from ack.vim?

  • bettergrep is mostly like ack.vim with a bit more opinionated defaults, quickfix window mappings that are more like NERDTree mappings. Asynchronous execution baked in by default. bettergrep also is more agnostic than ack.vim albeit ack.vim is still configurable, so the command functions are :Grep instead of :Ack.

vim-bettergrep's People

Contributors

ajitid avatar qalshidi avatar whoissethdaniel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ajitid

vim-bettergrep's Issues

Vim bettergrep not searching anything

This plugin is not searching anything for anything.

It used to run well and suddenly it stopped searching for anything.

It is also not outputting an error. How do I debug the issue?

Bash error with complex search pattern

Hello,

First thanks for your plugin!

When I search for a pattern like '"example", \[' that works well with ripgrep in command-line, it generates a bash syntax error with the function Grep of your plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.