Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
Search for files (ack -g).
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Mar 31, 2010
1 parent 9330e7b commit 724747b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions doc/ack.txt
Expand Up @@ -34,6 +34,12 @@ shows the results in a split window.
Just like |:Ack| + |:lgrepadd|. Searches, but appends results to
|location-list|

:AckFile [options] {pattern} [{directory}] *:AckFile*

Search recursively in {directory} (which defaults to the current
directory) for filenames matching the {pattern}. Behaves just like the
|:grep| command, but will open the |Quickfix| window for you.

Files containing the search term will be listed in the split window, along
with the line number of the occurrence, once for each occurrence. <Enter> on
a line in this window will open the file, and place the cursor on the matching
Expand Down
11 changes: 8 additions & 3 deletions plugin/ack.vim
Expand Up @@ -13,13 +13,17 @@ if !exists("g:ackprg")
let g:ackprg="ack -H --nocolor --nogroup --column"
endif

" Format, used to manage column jump
let g:ackformat="%f:%l:%c:%m"

function! s:Ack(cmd, args)
redraw
echo "Searching ..."

" Format, used to manage column jump
if a:cmd =~# '-g$'
let g:ackformat="%f"
else
let g:ackformat="%f:%l:%c:%m"
end

let grepprg_bak=&grepprg
let grepformat_bak=&grepformat
try
Expand Down Expand Up @@ -51,3 +55,4 @@ command! -bang -nargs=* -complete=file AckAdd call s:Ack('grepadd<bang>', <q-arg
command! -bang -nargs=* -complete=file AckFromSearch call s:AckFromSearch('grep<bang>', <q-args>)
command! -bang -nargs=* -complete=file LAck call s:Ack('lgrep<bang>', <q-args>)
command! -bang -nargs=* -complete=file LAckAdd call s:Ack('lgrepadd<bang>', <q-args>)
command! -bang -nargs=* -complete=file AckFile call s:Ack('grep<bang> -g', <q-args>)

0 comments on commit 724747b

Please sign in to comment.