Some time ago I came across sift, a “fast and powerful open source alternative to grep”. ack has long been my weapon of choice, but it depends on Perl while sift is distributed as a single executable.
After using it as my daily driver for a couple of months I’ve noticed that it’s a worthy competitor to git-grep, although the latter is still a bit faster.
sift has a feature,
--write-config, which enables you to save your
configuration directly on the command line:
sift --smart-case --filename --line-number --group --column --git --exclude-files=tags,.gitattributes --write-config
--git flag makes it possible to ignore patterns from a project’s
file, which is super nice.
Fuzzy file finding
You can use the flag
--targets to use sift as a fuzzy file finder:
sift --targets --ext js
You can also supply a pattern in order to narrow down the search:
sift --targets --ext js test
Integrating with Vim
To use sift in Vim, configure the
set grepprg=sift\ --no-group\ --no-color set grepformat=%f:%l:%c:%m,%f:%l:%m
Depending on how you’ve configured it you may need to add additional flags. In
order for the above
grepformat to work you have to have
To use it as an indexer for CtrlP, add this:
let g:ctrlp_user_command = 'sift --no-conf --ignore-case --no-color --no-group --git --targets --path "" %s'
And you’re good to go!