I told Mercurial to use vim as default editor:

editor = /opt/local/bin/vim

The referenced vim was installed via MacPorts:

$ port installed | grep vim
  vim @8.0.0596_0+huge (active)

When calling vim on the command line, I also end up at the one installed via MacPorts:

$ which vim

When I want to diff a file using Mercurial, I get some strange errors according to missing color none:

Error detected while processing function AnsiEsc#AnsiEsc:

line 527:

E254: Cannot allocate color none

Press ENTER or type command to continue

I don't have a clue where this is coming from. My first idea was the last installed plugin. I removed it, but nothing changed. Then I poked around my .vimrc, also without success. Also moving ~/.vimrc and ~/.vim to have a more or less vanilla vim didn't help. So now I'm stuck.

:scriptnames doesn't contain AnsiEsc and looking for it via find also didn't give a result. Also greping for it in the folders that scriptnames told to contain scripts didn't produce a match.

How to get rid of this error message? What is AnsiEsc (if ?not? a vim plugin), who uses it and why? Or how can I find out why vim is loading AnsiEsc and why it has this error?


A simple web search would have pointed you to the plugin page at vim.org. AnsiEsc is a plugin that extends syntax highlighting to interpret ANSI escape codes (something like ^[[01;42;31m). Unix terminals use these to add text attributes and colors. If you capture some command's output, and open that in Vim, the plugin can do its magic, though it usually needs to be triggered manually via :AnsiEsc.

Regarding the error: That could be a bug in the plugin. First, I'd check the latest version found on the author's homepage. Or, if you don't want this at all, uninstall it! How? Well, that depends on whether you use a plugin manager. If not, just remove plugin/AnsiEscPlugin.vim and autoload/AnsiEsc.vim and doc/AnsiEsc.txt from your ~/.vim/ directory (or the system directory, if it's installed for all users. :scriptnames gives you a clue where this is).

Do you use a Vim "distribution" like spf-13 and Janus? These lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.

  • Thanks for your answer. But there is not AnsiEsc installed anywhere. I already stated that moving my ~/.vim/ away didn't change anything, also :scriptnames doesn't show AnsiEsc to be installed somewhere. And no, I didn't use a distribution, as I tried to point out by telling that vim was installed via MacPorts. However, thanks for your input, even though it didn't solve my problem. Can it be that it is contained in some other script? – PVitt Aug 10 '17 at 13:39
  • If Vim prints out the Error detected while processing function AnsiEsc#AnsiEsc error, there has to be a file named AnsiEsc.vim somewhere (autoload rules), and after that error occured, :scriptnames should show its location. – Ingo Karkat Aug 10 '17 at 13:50
  • find and grep also didn't produce a result. I'm a little puzzled why vim is using AnsiEsc at all. – PVitt Aug 10 '17 at 13:50
  • You could try to capture a log with vim -V20vimlog; maybe that shows more details. – Ingo Karkat Aug 10 '17 at 13:50
  • Ok, I figured it out. It comes from the vimpager plugin, which has an opt out support for AnsiEsc. Thanks a lot for your help! – PVitt Aug 10 '17 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.