Skip to content

Instantly share code, notes, and snippets.

@TwP
Created October 23, 2009 18:08
Show Gist options
  • Save TwP/217086 to your computer and use it in GitHub Desktop.
Save TwP/217086 to your computer and use it in GitHub Desktop.
function! AckSnippets(search)
let ft = &ft
if ft == 'objc' || ft == 'cpp' || ft == 'cs'
ft = 'c'
elseif ft == 'xhtml'
ft = 'html'
endif
let dirs = join(split(
\ globpath(g:snippets_dir, ft)."\n".
\ globpath(g:snippets_dir, ft.'-*'),
\ "\n"), ' ')
let grepprg_bak=&grepprg
exec "set grepprg=" . g:ackprg
execute "silent! grep! -a " . a:search . ' ' . dirs
botright copen
let &grepprg=grepprg_bak
exec "redraw!"
endfunction
command -nargs=? Acks call AckSnippets('<args>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment