Vim Tip: Fix plugin loading error “Not an editor command: ^M”

This post is a preservation of the now inactive: https://nlknguyen.com/2016/06/03/vim-tip-fix-plugin-loading-error-not-an-editor-command-m/

One of the most annoying errors you probably already encountered  with Vim terminal (not GVim) on Windows when you use Vim plugins that were obtained through Git (via plugin manager like Vundle, Pathogen, etc.) is this kind of error message:

E492: Not an editor command: ^M
line    9:
E182: Invalid command name
line   10:
E492: Not an editor command: ^M
line   12:
E182: Invalid command name
line   13:
E492: Not an editor command: ^M
line   15:
E182: Invalid command name
line   16:
E492: Not an editor command: ^M
line   18:
E182: Invalid command name

This error is reported and asked so many times on StackOverflow and GitHub, and the answers provided are mostly about removing the special character or setting file format to “unix”. However, that wouldn’t solve the problem.

It took me a very long time (I gave up many times) to finally find out the solution through this GitHub issue on Vundle. It wasn’t something many people would expect. Turned out Git’s default setting to deal with line endings is not sufficient.

All you need to do is to config your Git correctly before cloning Vim plugins:

$ git config --global core.autocrlf input

That’s it. Now you can install Vim plugins like normal.

For more information about the above Git setting, see here.

Author: Jeff

Born a cantankerous old man, mellowed ever so slightly by age.

10 thoughts on “Vim Tip: Fix plugin loading error “Not an editor command: ^M””

  1. Please fix DarkRoom for .Net 4.6 and higher, which is default on Windows 10. Unhandled exception occurred…

  2. Attractive section of content. I just stumbled upon your web site and in accession capital
    to assert that I acquire actually enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and even I achievement you access consistently fast.

  3. What you said made a lot of sense. But, what about this?
    suppose you composed a catchier title? I mean, I don’t wish to tell you how to run your blog, but
    suppose you added something that makes people desire more? I mean Vim
    Tip: Fix plugin loading error "Not an editor command: ^M" | jjafuller.com
    is a little plain. You might glance at Yahoo’s front page and watch
    how they create post titles to get people to open the
    links. You might add a related video or a related picture or two to get people excited about what you’ve got to say.
    In my opinion, it would bring your blog a little livelier.

  4. If you are playing online slots using real child maintenance for
    sure, you should pay attention to some of this before you finally fail
    to bring house the victory. In this advocate get older you can accomplishment online
    slots re everywhere, even to make transactions you can in addition to use online bank transfers or even upon some sites you
    can make deposits using credit.

    Some things that you have to pay attention to are actually
    quite common, but people often ignore them and underestimate them, as a result
    in the stop what happens is that the person loses all of the initial capital to
    bet. so you should begin reading another time and listening to some of the bearing in mind that will make you
    able to enjoy online slot games without excruciating about losing.

  5. Thank you for any other great post. The place else
    may anyone get that type of information in such an ideal way of writing?
    I’ve a presentation next week, and I am at the search for such information.

  6. I do accept as true with all the concepts you’ve presented for your
    post. They are really convincing and can definitely work.
    Nonetheless, the posts are too brief for novices. May you please extend them a little from
    next time? Thanks for the post.

Leave a Reply

Your email address will not be published. Required fields are marked *