ack.vim icon indicating copy to clipboard operation
ack.vim copied to clipboard

E492: Not an editor command: Ack

Open arvinsim opened this issue 9 years ago • 31 comments

  • 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.

arvinsim avatar Mar 10 '15 05:03 arvinsim

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?

ches avatar Mar 10 '15 14:03 ches

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'

arvinsim avatar Mar 11 '15 07:03 arvinsim

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?

JonDum avatar May 13 '15 16:05 JonDum

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.

ches avatar Jun 06 '15 05:06 ches

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 avatar Dec 10 '15 20:12 skiz

@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?

ches avatar Dec 11 '15 20:12 ches

@arvinsim config

let g:ackprg = "ag --vimgrep"

in ur .vimrc file,and problem will be solved

zsusyt avatar Dec 16 '15 11:12 zsusyt

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.

jonesdeini avatar Apr 25 '16 23:04 jonesdeini

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!

jonesdeini avatar Apr 25 '16 23:04 jonesdeini

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 avatar May 11 '16 18:05 udnisap

@udnisap Thanks! this solved my issue

MJ111 avatar May 27 '16 11:05 MJ111

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 my vimrc.
  • 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 avatar Jul 08 '16 18:07 thenickcox

@thenickcox Could you please verify that ack.vim is showing up in :scriptnames (a more easily-readable alternative to :echo &runtimepath mentioned above)?

ches avatar Jul 08 '16 18:07 ches

Also, please share if :echo executable('ack') does not print "1".

ches avatar Jul 08 '16 19:07 ches

@ches Sorry, see my update. Everything is all good.

thenickcox avatar Jul 08 '16 19:07 thenickcox

brew install ack fixes this issue for me

binarymason avatar Aug 05 '16 15:08 binarymason

"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

yummish avatar Nov 14 '16 06:11 yummish

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'

azat-io avatar Jul 16 '17 15:07 azat-io

For me.. the solution is just instead of typing :ACK I need to use :Ack..

Notice the letter case is different.

jasperzs avatar Mar 10 '18 21:03 jasperzs

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

rohanghige avatar May 27 '18 06:05 rohanghige

Installing ack fixed this but Not an editor command: Ack isn't very informative. Maybe it can say that ack executable is missing?

sanbornm avatar Jul 17 '18 00:07 sanbornm

In windows, just run choco install ack in cmd prompt.

hrai avatar Jul 26 '18 06:07 hrai

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.

komali2 avatar Apr 30 '19 17:04 komali2

sudo apt-get install ack solved my problem on Ubuntu 19.04

mentorkadriu avatar May 30 '19 07:05 mentorkadriu

: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.

0xhmn avatar Nov 15 '19 17:11 0xhmn

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!

russoue avatar Apr 17 '20 19:04 russoue

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.

yannickperrenet avatar Feb 14 '22 12:02 yannickperrenet

brew install ack fixes this issue for me

This work for me too :D thanks XD

shashinvision avatar May 12 '22 13:05 shashinvision

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

dkaszews avatar Apr 02 '24 07:04 dkaszews

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.

dkaszews avatar Apr 02 '24 07:04 dkaszews