Vim启动错误(无效表达式)Debian

Pal*_*dan 14 vim debian

我在设置Vim时遇到了问题.首先,我在启动Vim时遇到一堆错误,我收到了以下错误:

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
Run Code Online (Sandbox Code Playgroud)

此外,当我尝试运行:helptags ~/.vim/doc它时根本不加载.它只显示一个空白的编辑器屏幕.

我很感激你的帮助,我在网上寻找解决方案,但我一直无法修复它.我真的想开始使用Vim.谢谢!

编辑:我添加了我的.vimrc

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

Ing*_*kat 29

天啊!我看到几个问题:

E492: Not an editor command: generate helptags for everything in 'runtimepath'
Run Code Online (Sandbox Code Playgroud)

你必须有一个从generate helptags ...某个地方开始的行(你的~/.vimrc?); 它应该是一个评论:前置"一行.


***** L9 library must be installed! *****
Run Code Online (Sandbox Code Playgroud)

FuzzyFinder插件需要另一个插件; 你可以在L9 - Vim脚本库中找到它.


Error detected while processing /home/lee/.vim/plugin/refactor.vim:
line   45:
E492: Not an editor command: ^M
Run Code Online (Sandbox Code Playgroud)

这是由在Linux上使用时具有Windows风格的CR-LF行结尾的Vimscript文件引起的.在Vim中打开相应的文件,并通过它们将它们转换为Unix风格的结尾

:w ++ff=unix
Run Code Online (Sandbox Code Playgroud)

我希望你能在这些之后看到光明.完整的Vim配置链接有助于进一步诊断.如果您是Vim的新手,建议您先从精简版开始.vimrc,然后逐渐添加插件,以便更加熟练并确定需求.

  • 嗯.我想我们应该设置2小时轮班:你做2小时,我做2小时,FDinoff做2小时,肯特做2小时...... (2认同)

Yuk*_*awa 7

对于这E492: Not an editor command: ^M部分,我实际上遇到了同样的问题,但上述答案没有帮助.所以我找到了这个,它对我有用:

对于Cygwin(我使用):从软件包安装程序安装dos2unix

对于Ubuntu/Debian:

sudo apt-get install tofrodos; sudo ln -s /usr/bin/fromdos /usr/bin/dos2unix
Run Code Online (Sandbox Code Playgroud)

对于CentOS,Fedora,......:

sudo yum install dos2unix
Run Code Online (Sandbox Code Playgroud)

然后以这种方式使用它:

dos2unix ~/.vimrc
Run Code Online (Sandbox Code Playgroud)

这应该从文件中清除所有CRLF

  • 你也可以在vim和`:set ff = unix`中打开`.vimrc`文件,然后保存它以将所有文件结尾转换为unix-style. (3认同)

Sco*_*ade 6

我看到这些类型的错误:

Error detected while processing ~/.vim/plugin/<some_plugin_giving_you_error>:
line   45:
E492: Not an editor command: ^M
Run Code Online (Sandbox Code Playgroud)

.gitconfig具有 Windows 相关的[core]设置但在 Linux 机器上使用时。然后当一个插件被 Vim 插件管理器或手动下载时,这些错误开始出现。

所以我建议检查你的 Git 设置,删除下载的文件,然后再试一次。


小智 5

linux 中的简单选项。转到包文件夹 ~/.vim/bundle或特定的包目录执行find . | xargs dos2unix