1

Running :Ack anything in gvim now gives

|| /bin/bash: ack-grep: command not found

ack-grep is already the newest version (2.22-1)

It was working fine in Ubuntu 16.04. I have the ack.vim plugin in ~/.vim/bundle/ack.vim/

rigyt
  • 2,219
  • 3
  • 28
  • 40
  • 1
    what happens if you run ack-grep from the terminal? – Christian Gibbons May 16 '18 at 17:36
  • ack-grep: command not found, but maybe that's only because I ran: sudo dpkg-divert --local --divert /usr/bin/ack --rename --add /usr/bin/ack-grep ? – rigyt May 16 '18 at 17:50
  • 1
    You'll probably get better help over at 'ask ubuntu' now that we've established it's not really a problem with your vim setup. – Christian Gibbons May 16 '18 at 18:12
  • They just said to use ask instead of ack-grep. I don't know how to get ack.vim working – rigyt May 17 '18 at 11:20
  • Looks like `g:ackprg` is a var where you can select the command to run, so maybe you can point it to `ask` or whatever else might be compatible with its purpose. The github page has an example of using the Silver Searcher with the command `ag --vimgrep` – Christian Gibbons May 17 '18 at 17:23

1 Answers1

1

Assuming you are using this ack.vim plugin. Then you shouldn't have to do anything.

Ack.vim will search for executables in the following order: ack-grep, ack. You can override this with g:ackprg. If you have set g:g:ackprg then you will need to adjust g:ackprg to be set to where the ack executable path.

let g:ackprg = '/usr/local/bin/ack'

Personally, I would avoid setting the g:ackprg variable unless you really need to.

You may also want to look into faster grep program's than ack. e.g. The Silver Searcher or ripgrep. I also haven't really found a need for a plugin like ack.vim, I just set 'grepprg' and 'grepformat' and search with :grep.

Peter Rincker
  • 43,539
  • 9
  • 74
  • 101
  • Just installing the Silver Searcher fixed it, thanks. ack.vim just worked as before after that. ack.vim lets me search the word under the cursor with \AK which is handy. Not sure is that available with just grep. – rigyt May 24 '18 at 11:57
  • Ripgrep/Silver searcher "star search": `nnoremap * :execute "grep '" . expand('') . "' -w"redraw!:cc` – Peter Rincker May 24 '18 at 14:10