Skip to content

Rust parallel grep supporing custom .ignore files

Notifications You must be signed in to change notification settings

dhilst/gkosgrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crates.io

Overview

Small tool for greping supporting .gitignore and custom .ignore file. This make easy to ignore files that reside in git like rspec support files.

Installation

cargo install gkosgrep

Usage

I did this to use inside vim as a replacement for the silver searcher that would be easier to customize what is ignored. The usage is damn simple

gkosgrep <path> [pattern]

If ignored file is missing it is just ignored. To use this with fzf inside vim, do:

command! -bang -nargs=* Gkosgrep
      \ call fzf#vim#grep(
      \   $HOME.'/.cargo/bin/gkosgrep . '.shellescape(<q-args>), 0,
      \   {}, <bang>0)

Then use Gkosgrep command to filter files

If you (like me) want searches to ignore file names use this

function! GkosGrepFzf(query, fullscreen)
  let command_fmt = 'gkosgrep . %s || true'
  let initial_command = printf(command_fmt, shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}')
  let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 0, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang GkosGrep call GkosGrepFzf(<q-args>, <bang>0)

Debugging

RUST_LOG cargo run -F debug_macros ./test/ foo

About

Rust parallel grep supporing custom .ignore files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages