ack.vim
ack.vim copied to clipboard
E492: Not an editor command: Ack
-
I installed the plugin via Pathogen by cloning this repository into .vim/bundle
-
I installed the single file version of the ack executable in my machine. I tested ack in the terminal as a sanity check and it worked.
-
When I try to run Ack in Vim, I get this error
E492: Not an editor command: Ack
Is there a step I am missing? I looked at the docs and searched Google for solutions but there doesn't seem to be anything that can help.
It sounds as if the plugin isn't loading. There are two likely paths for that:
- Something is wrong with your Pathogen setup
- ack.vim can't find your
ack
executable on$PATH
The first seems unlikely, I'm guessing you probably have some other plugins working through Pathogen, but just to be sure, run :echo &runtimepath
in Vim and ensure that you see ~/.vim/bundle/ack.vim
.
Which approach did you take for installing Ack? From within Vim, can you run :!ack --help
successfully? Does :echo $PATH
reflect the same paths that you expect from your normal shell environment, including where ack
is installed?
The first seems unlikely, I'm guessing you probably have some other plugins working through Pathogen, but just to be sure, run :echo &runtimepath in Vim and ensure that you see ~/.vim/bundle/ack.vim.
I ran the command and I found the ack.vim path in it.
Which approach did you take for installing Ack? From within Vim, can you run :!ack --help successfully? Does :echo $PATH reflect the same paths that you expect from your normal shell environment, including where ack is installed?
I ran :echo $PATH
and I did not see the path where ack resides. I tried to append the path where ack is to $PATH
in my .vimrc
file but to no avail.
let $PATH .= '~/bin'
I've been using Ack.vim fine for years. I haven't updated my the repo in bundle/
for many months, but after recently doing so I'm now getting the same error as @arvinsim. Anything I can do to narrow this down?
Apologies for delay in following up here. A kludgy solution might be to set g:ackprg
with a full path, e.g.
let g:ackprg = "/home/username/bin/ack -s -H --nocolor --nogroup --column"
In @arvinsim's case it appears that PATH
is the issue, if all that changed in your setup @JonDum was updating ack.vim then it seems unlikely that this would break suddenly, but please do check your PATH
within Vim as suggested above and confirm.
Getting PATH
consistent in Vim is a bit out of scope for me I'm afraid, would need to ask a lot of questions about your shell environment, etc. You might want to start with this Stack Overflow question and other similar ones.
I encountered the same issue on Debian. ack is now known as ack-grep, however the plugin doesn't look for ack-grep (ack is an existing Kanji package name). I resolved this symlinking ack-grep to /usr/local/bin/ack and restarting vim. Perhaps the plugin should also look for an ack-grep binary?
@skiz The plugin does look for ack-grep—perhaps your version of the plugin is old, or executable('ack-grep')
fails in your Vim for some reason?
@arvinsim config
let g:ackprg = "ag --vimgrep"
in ur .vimrc file,and problem will be solved
Sorry to resurrect this, but why do we look for ack
before ack-grep
?
I would think users should be able to have both ack
and ack-grep
installed without having to add a vimrc entry.
I found this issue after searching to see if others had the same problem as I was having. After re-reading it seems I may have hijacked this a bit. I've made https://github.com/mileszs/ack.vim/pull/180 for my issue.
Sorry!
installing ack
on my mac fixed this issue
brew install ack
may be we can add a warning when the host doesnt have ack
installed??
@udnisap Thanks! this solved my issue
I'm getting this, as well.
- I installed ack through pathogen and have other plugins working successfully.
- I installed ack through homebrew (I have ack 2.14)
- I can successfully run
:!ack --help
- ack is installed in
/usr/local/bin
, which is found when I run:echo $PATH
in vim - I can run
ack foobar
from a directory on the CLI and get results - I've re-
sourced
myvimrc
. - I tried @ches's suggestion, providing the full path to ack
- I tried re-installing ack through homebrew
- I tried re-installing ack.vim through pathogen
Still getting Not an editor command: Ack
.
I'm on vim 7.4, OS X El Capitan.
Update
Apologies. I kept trying it on a file I already had open. I opened a new file and it worked. Keeping this here for a comprehensive list of things to check for.
@thenickcox Could you please verify that ack.vim
is showing up in :scriptnames
(a more easily-readable alternative to :echo &runtimepath
mentioned above)?
Also, please share if :echo executable('ack')
does not print "1".
@ches Sorry, see my update. Everything is all good.
brew install ack
fixes this issue for me
"ack.vim is an interface to ack library, you have to first install the ack library from ack site, like for ubuntu "apt-get install ack-grep""
referenced: https://groups.google.com/forum/#!topic/vim_mac/g7I7kNHb_k8
I have the same problem on Arch Linux. This is the solution for me:
let g:ackprg = '/usr/bin/vendor_perl/ack -s -H --nogroup --column'
For me.. the solution is just instead of typing :ACK I need to use :Ack..
Notice the letter case is different.
Possible if you are having this issue on a fresh installation of Linux, you are probably missing 'ack-grep'. That's why you might be getting this error.
Try installing it as follows,
sudo apt-get install ack-grep
Installing ack fixed this but Not an editor command: Ack
isn't very informative. Maybe it can say that ack executable is missing?
In windows, just run choco install ack
in cmd prompt.
Any tips? My situation:
Tried to install via Plugged. I see a couple Plugged things in echo &runtimepath'
such as /home/me/.vim/plugged/vim-javascript
. However, I don't see ack anywhere. If I cd ~/.vim/plugged
and ls
I see ack.vim
and vim-javascript
(a directory).
:echo executable('ack')
prints 1.
I tried typing ACK
, Ack
, and ack
, all return "E492: Not an Editor Command."
ack
is installed on my system: ack --version
returns ack 2.22
.
sudo apt-get install ack
solved my problem on Ubuntu 19.04
:Ack!
was working for me just fine but today I am getting this error ‾_(ツ)_/‾
I am using mac and Ack is already installed using brew.
I had the same issue on a Fedora 30 desktop. The plugin was installed, ack
was there in the $PATH
, !ack --help
also worked. However, after I tried to install it again (not even a proper re-install) the issue got fixed. Putting it here in case it helps the Fedora users.
$ sudo yum install ack
[sudo] password for xxx:
Last metadata expiration check: 0:29:02 ago on Fri 17 Apr 2020 11:48:00 AM PDT.
Package ack-2.28-1.fc30.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Ran into this issue as well due to the if !exists("g:ackprg")
check.
After migrating my configuration to a new structure I no longer set let g:ackprg = 'rg --vimgrep --smart-case'
before loading the ack.vim
plugin which caused it to exit right away since I don't have ack
but ripgrep
installed. So the fix (for me) was to set g:ackprg
before loading ack.vim
.
brew install ack
fixes this issue for me
This work for me too :D thanks XD
Check :echo executable('ack')
and :!which ack
. If first returns 0
but second works, it may be that your $PATH
contains ~
which vim apparently does not resolve.
Following change in ~/.bashrc
fixed the issue for me:
- export PATH="${PATH}:~/.local/bin"
+ export PATH="${PATH}:${HOME}/.local/bin
Is there an active fork of this repo? It has not been updated in 6 years. I'd like to add echom "Ack executable not found"
in the plugin script to at minimum provide some feedback before a silent finish
.