Use ag instead of ack

https://github.com/ggreer/the_silver_searcher

* ag is faster than ack
* ag searches all files by default (but still ignores gitignored files). This
  removes the need for ack's `--type-add=` options.
* The command is 33% shorter than ack!
This commit is contained in:
Gabe Berke-Williams 2013-02-28 13:57:18 -05:00
parent 99c8831c94
commit 1f4e6d1370
5 changed files with 9 additions and 17 deletions

10
ackrc
View file

@ -1,10 +0,0 @@
# Search
--type-set=coffee=.coffee
--type-set=cucumber=.feature
--type-set=haml=.haml
--type-set=sass=.sass,.scss
# Don't search
--ignore-dir=log
--ignore-dir=tags
--ignore-dir=tmp

3
agignore Normal file
View file

@ -0,0 +1,3 @@
log
tags
tmp

View file

@ -9,4 +9,4 @@ shift
replace_with=$1
shift
ack -l $find_this $* | xargs sed -i '' "s/$find_this/$replace_with/g"
ag -l $find_this $* | xargs sed -i '' "s/$find_this/$replace_with/g"

9
vimrc
View file

@ -73,9 +73,10 @@ if filereadable(".vimrc.local")
source .vimrc.local
endif
" Use Ack instead of Grep when available
if executable("ack")
set grepprg=ack\ -H\ --nogroup\ --nocolor
" Use Ag (https://github.com/ggreer/the_silver_searcher) instead of Grep when
" available
if executable("ag")
set grepprg=ag\ --noheading\ --nogroup\ --nocolor
endif
" Color scheme
@ -114,8 +115,6 @@ map <Leader>ct :!ctags -R .<CR>
" Cucumber navigation commands
autocmd User Rails Rnavcommand step features/step_definitions -glob=**/* -suffix=_steps.rb
autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes
" :Cuc my text (no quotes) -> runs cucumber scenarios containing "my text"
command! -nargs=+ Cuc :!ack --no-heading --no-break <q-args> | cut -d':' -f1,2 | xargs bundle exec cucumber --no-color
" Switch between the last two files
nnoremap <leader><leader> <c-^>

View file

@ -1,4 +1,4 @@
#compdef ack
#compdef ag
if (( CURRENT == 2 )); then
if [[ -a tmp/tags ]]; then