Guest User

Untitled

a guest
Apr 23rd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. function! AckSnippets(search)
  2. let ft = &ft
  3. if ft == 'objc' || ft == 'cpp' || ft == 'cs'
  4. ft = 'c'
  5. elseif ft == 'xhtml'
  6. ft = 'html'
  7. endif
  8.  
  9. let dirs = join(split(
  10. \ globpath(g:snippets_dir, ft)."\n".
  11. \ globpath(g:snippets_dir, ft.'-*'),
  12. \ "\n"), ' ')
  13.  
  14. let grepprg_bak=&grepprg
  15. exec "set grepprg=" . g:ackprg
  16. execute "silent! grep! -a " . a:search . ' ' . dirs
  17. botright copen
  18. let &grepprg=grepprg_bak
  19. exec "redraw!"
  20. endfunction
  21. command -nargs=? Acks call AckSnippets('<args>')
Add Comment
Please, Sign In to add comment