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
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.
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
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.
Simple option in linux.
Goto the bundle folder ~/.vim/bundle or the specific package dir execute find . | xargs dos2unix.
the simple way without any tools involve:
more .vimrc #prepare for the copy paste
vi .vimrc #start with a blank .vimrc
copy paste the original .vimrc content to the blank .vimrc
done
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.
Related
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 21 2017 01:21:26)
MacOS X (unix) version
Included patches: 1-1207
My .vimrc has
:nmap ,s :source ~/.vimrc I tried that right after installing the mccvim just now, and got these errors:
Error detected while processing /Users/jk/.vimrc:
line 18:
E15: Invalid expression: 0^M
line 20:
E15: Invalid expression: has("gui_running") && has("menu")^M
line 99:
E15: Invalid expression: 0^M
line 101:
E15: Invalid expression: has("gui_running") && has("menu")^M
line 203:
E15: Invalid expression: 0^M
line 205:
E15: Invalid expression: has("gui_running") && has("menu")^M
I don't find '0^M' in the .vimrc at all.
Everything was fine until the update; what happened?
Unix-like systems (including OSX) and Windows have different conventions on what "end of line" should look like. Unix uses LF (ASCII 0A, also represented as ^J); Windows uses CRLF (ASCII 0D0A, also represented as ^M^J.
Vim can use both kinds of files, depending on its fileformats (ffs) setting. set ffs=unix,dos will make Vim try to guess how the file is formatted, and sets the fileformat (ff) accordingly. However, if ffs is set to just unix, then Vim will not try to guess, ff gets set to unix; under this setting, if the file was saved for Windows (i.e. has CRLF line endings), LF will be interpreted as newline, and CR will be presented as ^M. Vimscript doesn't know what to do with ^M, and complains.
To convert your file to Unix format (the recommended action, since your file is foreign to the operating system you're using), run these commands:
:e ++ff=dos .vimrc
:setl ff=unix
:w
I have a simple .vimrc file. It is 3 lines in its entirety:
execute pathogen#infect()
syntax on
filetype plugin indent on
When I try to start vim, though, I get the following error message:
Error detected while processing /home/simoonp/.vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
I searched many means , but the question hasn't been solved.
I'm getting this error with Vundle begin method.
Error detected while processing function vundle#end..vundle#config#activ
ate_bundles..<SNR>4_rtp_add_a:
line 4:
E117: Unknown function: fnameescape
E15: Invalid expression: 'set rtp^='.fnameescape(prepends)
line 5:
E117: Unknown function: fnameescape
E15: Invalid expression: 'set rtp+='.fnameescape(appends)
Error detected while processing function vundle#end..vundle#config#activ
ate_bundles..<SNR>4_rtp_add_defaults:
line 7:
E117: Unknown function: fnameescape
E15: Invalid expression: fnameescape(default_rtp_items[0])
line 8:
E121: Undefined variable: first_item
E15: Invalid expression: 'set rtp-=' . first_item
line 9:
E121: Undefined variable: first_item
E15: Invalid expression: 'set rtp^=' . first_item
Error detected while processing D:\GVimPortable\Data\settings\vimrc:
line 117:
E518: Unknown option: relativenumber
line 357:
E185: Cannot find color scheme solarized
I've used Vundle with MAC before, but in windows it's not working.
Not sure it's with windows specific or not.
Please help if you have any idea about this issue.
Thanks
Your Vim doesn't have the fnameescape() function, nor 'relativenumber'. It must be a really old Vim version, like 7.0 or 7.1. You can check with :version.
To use Vundle, you need to upgrade to a newer version; i.e. 7.4 or 8.0.
I'm trying to install Syntastic for Vim using Cygwin. After completing step 2.1 and the cloning part of step 2.2 in the installation guide of Syntastic, I find that now when I run vim I get the following errors:
Error detected while processing /home/rjw08/.vim/bundle/syntastic/plugin/syntastic/autoloclist.vim:
line 1:
E15: Invalid expression: exists("g:loaded_syntastic_notifier_autoloclist") || !exists("g:loaded_syntastic_plugin")^M
line 39:
E171: Missing :endif
Error detected while processing /home/rjw08/.vim/bundle/syntastic/plugin/syntastic/balloons.vim:
line 1:
E15: Invalid expression: exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin")^M
line 67:
E171: Missing :endif
Error detected while processing /home/rjw08/.vim/bundle/syntastic/plugin/syntastic/checker.vim:
line 1:
E15: Invalid expression: exists("g:loaded_syntastic_checker") || !exists("g:loaded_syntastic_plugin")^M
There were a few more errors, but they follow this basic format. From what I understand, file endings in the listed files are incorrect (i.e. ^M). However when I open these files in Vim, there does not seem to be any ^M endings to delete.
How do I fix this problem?
Load the file into vim, then :set fileformat=unix and :wq should fix it.
PS: you don't see the ^Ms because vim thinks it is a dos file (it probably says [dos] in the status bar after loading).
This command will transform every file to a unix file in the ~/.vim/bundle directory.
find ~/.vim/bundle -type f -follow -print|xargs dos2unix
I am using a linux OS and attempting to find the ^M characters in a .vim file, specifically jcommenter.vim. I would like to find and replace the ^M characters but am unable to do so. I have tried
%s/^V^M//g
and
%s/\r/\r/g
Unfortunately neither are able to find ^M. I have read that when vim reads a file, it will not include ^M, is this true? How can I find and get rid of ^M?
Edit:
This is a sample of the error I recieve:
line 21:
E492: Not an editor command: ^M
line 31:
E492: Not an editor command: ^M
This occurs everywhere there is a blank line.
EDIT:!!!
I have found a clue!
/usr/share/vim/macros/jcommenter.vim"[converted][dos]
dos?????? How do I destroy [converted][dos]?
To convert your file from "dos" format to "unix" format, load the file in vim and do:
:set ff=unix
:w
:q
The ff is short for fileformat.
You can do like
$ dos2unix plugin/jcommenter.vim
Use fromdos file (in command line, not in vim). This usually gets rid of odd control characters.
If you don't have it you can get it from the standard repos