Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to map some commands to a shortcut in vim. Specifically, I'm trying to get a colorized git diff. If I type this command in Ex mode, it works as expected:

:! git diff --staged % | colordiff | less -R

But if I try to map it in my .vmirc,

map ,gds :! git diff --staged % | colordiff | less -R<CR>

I get the error:

E492: Not an editor command: colordiff | less -R<CR>

I have other mapped commands using a pipe just fine, so it doesn't seem like that should cause a problem. If I call colordiff by its full path, it doesn't help, either. What gives?

share|improve this question
You should take advantage of vimdiff mode as the plugins such as CVSmenu. Otherwise, have you tried \| instead ? – Luc Hermitte Jun 21 '10 at 15:29
D'oh! \| did it. I figured it was something stupid. I'll check out CVSmenu, but you should put your comment as an answer, so I can give you credit. :) – Alison R. Jun 21 '10 at 15:39
up vote 9 down vote accepted

(OK, here it is -- I wasn't sure about \|)

Try \| instead of |.

But you should instead have a look at the vimdiff mode, and how plugins like CVSmenu proceed. BTW, IIRC there already exists a (likely several) plugin that integrates git into vim.

share|improve this answer

To add to Luc's answer, this is because | is the command separator in vim, similar to ; in bash

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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