19

I'm having issues setting up Vim. Firstly I'm having a bunch of errors when start up Vim, I get these errors:

Error detected while processing /home/lee/.vimrc:
line    5:
E492: Not an editor command: generate helptags for everything in 'runtimepath'
Error detected while processing /home/lee/.vim/plugin/fuf.vim:
line   13:
***** L9 library must be installed! *****
Error detected while processing /home/lee/.vim/plugin/refactor.vim:
line   45:
E492: Not an editor command: ^M
line   53:
E492: Not an editor command: ^M
line   55:
E15: Invalid expression: ["auto", "const", "double", "float", "int", "short", "struct", "unsigned", "break", "continue", "else", "for", "long", "signed", "switch", "void", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "char", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "bool", "explicit", "new", "static_cast", "typeid", "catch", "false", "operator", "template", "typename", "class", "friend", "private", "this", "using", "const_cast", "inline", "public", "throw", "virtual", "delete", "mutable", "protected", "true", "wchar_t", "size_t"]^M
line   56:
E492: Not an editor command: ^M
line   58:
E15: Invalid expression: '\<\h\w*\>'^M
line   59:
E15: Invalid expression: '\s*[*&]*\s*'^M
line   60:
E121: Undefined variable: s:IdentifierPattern
E15: Invalid expression: s:IdentifierPattern . s:TypePostfixPattern^M
line   62:
E121: Undefined variable: s:TypeElementPattern
E15: Invalid expression: '\%(' . s:TypeElementPattern . '\%(' . s:TemplateParameterPattern . s:TypePostfixPattern . '\)*' . s:TypePostfixPattern . '\)\+'^M
line   64:
E15: Invalid expression: '\%(\s\+\n*\s*\|\n\+\|\s*\n*\s\+\)'^M
line   65:
E121: Undefined variable: s:TypeIdentifierPattern
E15: Invalid expression: s:TypeIdentifierPattern . s:MissableSeperatorPattern . s:IdentifierPattern . '\%\(\[\d*\]\)*'^M
line   66:
E121: Undefined variable: s:TypeIdentifierPattern
E15: Invalid expression: '^\s*\%(' . s:TypeIdentifierPattern . s:SeperatorPattern. '\|' . s:IdentifierPattern . '::\)\+' ^M
line   67:
E121: Undefined variable: s:VariableDeclarationPattern
E15: Invalid expression: '(' .  s:MissableSeperatorPattern . '\%(' . s:VariableDeclarationPattern . '\%(\s*,' . s:MissableSeperatorPattern . s:VariableDeclarationPattern . '\)*\)*\s*)'^M
line   68:
E121: Undefined variable: s:FunctionPerfixPattern
E15: Invalid expression: s:FunctionPerfixPattern . s:MissableSeperatorPattern . s:IdentifierPattern . s:MissableSeperatorPattern . s:ParameterListPattern . '[^(){;]*'^M
line   69:
E121: Undefined variable: s:FunctionPattern
E15: Invalid expression: s:FunctionPattern . s:MissableSeperatorPattern . '\%(;\)\@='^M
line   70:
E121: Undefined variable: s:FunctionPattern
E15: Invalid expression: s:FunctionPattern . s:MissableSeperatorPattern . '\%({\)\@='^M
line   71:
E492: Not an editor command: ^M
line   72:
E488: Trailing characters
line  114:
E492: Not an editor command: ^M
line  115:
E488: Trailing characters
line  182:
E492: Not an editor command: ^M
line  183:
E488: Trailing characters
line  220:
E492: Not an editor command: ^M
line  221:
E488: Trailing characters
line  240:
E492: Not an editor command: ^M
line  241:
E488: Trailing characters
line  285:
E492: Not an editor command: ^M
line  286:
E488: Trailing characters
line  359:
E492: Not an editor command: ^M
line  360:
E488: Trailing characters
line  372:
E492: Not an editor command: ^M
line  374:
E488: Trailing characters
line  411:
E492: Not an editor command: ^M
line  412:
E488: Trailing characters
line  424:
E492: Not an editor command: ^M
line  425:
E488: Trailing characters
line  432:
E492: Not an editor command: ^M
line  433:
E488: Trailing characters
Press ENTER or type command to continue

Also, when I try to run :helptags ~/.vim/doc it doesn't load at all. It just shows a blank editor screen.

I would appreciate your help, I've searched the web for solutions but I've been unable to fix it. I really want to start using Vim. Thank you!

EDIT: I added my .vimrc

set nocompatible
call pathogen#infect()
execute pathogen#infect()
call pathogen#helptags()
generate helptags for everything in 'runtimepath'
syntax on
filetype plugin indent on

6 Answers 6

35

Oh my gosh! I see several issues:

E492: Not an editor command: generate helptags for everything in 'runtimepath'

You must have a line starting with generate helptags ... somewhere (your ~/.vimrc?); it should be a comment: Prepend a " to the line.


***** L9 library must be installed! *****

The FuzzyFinder plugin requires another plugin; you can get it at L9 - Vim-script library.


Error detected while processing /home/lee/.vim/plugin/refactor.vim:
line   45:
E492: Not an editor command: ^M

That's caused by Vimscript files that have Windows-style CR-LF line endings when used on Linux. Open the corresponding file(s) in Vim and convert them to Unix-style endings via

:w ++ff=unix

I hope you'll start to see the light after these. A link to your full Vim config would be helpful to further diagnose this. If you're new to Vim, it's recommended to start with a lean .vimrc, and only gradually add plugins, as you become more proficient and identify the needs.

6
  • 2
    Hmm. I think we should setup 2 hours shifts: you do 2 hours, I do 2 hours, FDinoff does 2 hours, Kent does 2 hours…
    – romainl
    Feb 20, 2014 at 9:26
  • 1
    @romainl: Interesting how your answer mirrors mine! I guess nobody can complain about not getting their money's worth of Vim support on Stack Overflow :-) Feb 20, 2014 at 9:30
  • @IngoKarkat I added my .vimrc now can you take a look please?
    – Paludan
    Feb 20, 2014 at 9:48
  • You still need to comment out / remove line 5; apart from that, it's fine. Are you making progress on the other issues?! Feb 20, 2014 at 9:53
  • @IngoKarkat Yes I don't have any errors anymore, however when I write :helptags ~/.vim/doc nothing appears at all! I'll have your comment be the solution
    – Paludan
    Feb 20, 2014 at 9:55
9

For the E492: Not an editor command: ^M part, I actually got the same problem but the above answers didn't help. So I found this and it works for me:

For Cygwin (which I use): install dos2unix from the package installer

For Ubuntu/Debian:

sudo apt-get install tofrodos; sudo ln -s /usr/bin/fromdos /usr/bin/dos2unix

For CentOS, Fedora, ...:

sudo yum install dos2unix

Then use it this way:

dos2unix ~/.vimrc

That should clean all CRLF from the file

2
  • 4
    You can also just open the .vimrc file in vim and :set ff=unix and then save it to convert all of the file endings to unix-style.
    – naught101
    Feb 25, 2016 at 0:05
  • When working on windows, make sure to also edit line endings of any scripts that are loaded by .vimrc itself. Seems obvious but took me a while to realize that the errors are not coming from my .vimrc anymore...
    – swenzel
    Sep 26, 2016 at 8:12
6

I see these types of errors:

Error detected while processing ~/.vim/plugin/<some_plugin_giving_you_error>:
line   45:
E492: Not an editor command: ^M

when a .gitconfig has Windows relevant [core] settings but used on a Linux box. Then when a plugin is downloaded by either a Vim plugin manager or manually, these errors start showing up.

So I would suggest checking your Git settings, delete the downloaded files, and try again.

2
  • I copied my settings from Windows to WSL and hit this. In WSL your ~/.gitconfig should contain [core] > autocrlf = false
    – Noel Evans
    Jun 3, 2020 at 14:55
  • @Scott Wade your answer is so clutch, thanks! I don't know which idiot set autocrlf = true on my machine (I'm the only user lol), but I knew something fishy was going on. Since there is simply no way that all source files for the dozens of Vim plugins I've git cloned from GitHub written primarily by Mac and *nix hackers would all have CRLF endings by default.
    – Jethro Cao
    Nov 17, 2020 at 8:12
6

Simple option in linux. Goto the bundle folder ~/.vim/bundle or the specific package dir execute find . | xargs dos2unix.

1
  • thanks, this is great for translated files across windows/wsl/*nix etc. Jul 4, 2020 at 15:08
1

the simple way without any tools involve:

  1. more .vimrc #prepare for the copy paste
  2. vi .vimrc #start with a blank .vimrc
  3. copy paste the original .vimrc content to the blank .vimrc
  4. done
0
Error detected while processing /home/lee/.vimrc:
line    5:
E492: Not an editor command: generate helptags for everything in 'runtimepath'

That line is not commented

Error detected while processing /home/lee/.vim/plugin/fuf.vim:
line   13:
***** L9 library must be installed! *****

FuzzyFinder needs the L9 library but it didn't find it.

Error detected while processing /home/lee/.vim/plugin/refactor.vim:
line   45:
E492: Not an editor command: ^M

On Linux, Vim doesn't like Windows line endings and you seem to have a lot of them.

line   55:
E15: Invalid expression: ["auto", "const", "double", "float", "int", "short", "struct", "unsigned", "break", "continue", "else", "for", "long", "signed", "switch", "void", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "char", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "bool", "explicit", "new", "static_cast", "typeid", "catch", "false", "operator", "template", "typename", "class", "friend", "private", "this", "using", "const_cast", "inline", "public", "throw", "virtual", "delete", "mutable", "protected", "true", "wchar_t", "size_t"]^M

Same as above, the trailing ^M is the problem.

line   58:
E15: Invalid expression: '\<\h\w*\>'^M

And so on…

This command

:%s/<C-v><CR>//

should reduce the number of errors. <C-v><CR> means "hit Ctrl+V, then hit the Enter key".

Please show us your ~/.vimrc so that we can help you further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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