与cygwin内的vim病原体错误

我最近安装了cygwin(因为我限于Windows操作系统),并希望在其中使用Vim。 一切都安装完毕,我可以随时访问vim,并可以修改.vimrc之类的东西。 从之前的文章中,我了解到我的插件必须在Windows操作系统的vimfiles中,并且已经这样做了。 但是,现在当我尝试validation病原体时,我收到一个错误,指出:

E492: Not an editor command: ^M (this repeats a couple times) E15: Invalid expression: exists("g:loaded_pathogen") || &cp^M E117: Unknown function: pathogen#infect 

我的.virmc(再次非常基本,只是试图开始一切)

 version 6.0 if &cp | set nocp | endif let s:cpo_save=$cpo enter code here set cpo&vim map! <C-Home> <C-Home> map! <C-End> <C-End> let &cpo=s:cpo_save unlet s:cpo_save set autoindent set ff=unix set background=dark set backspace=2 set fileencodings=ucs-bom,utf-8,default,latin1 set helplang=en set history=50 set laststatus=2 set ruler set shelltemp set viminfo='100,<50,s10,h set window=55 " vim: set ft=vim : call pathogen#infect() syntax on filetype plugin indent on 

问候,

从shell中,尝试执行以下命令:

 find ~/.vim -type f -exec dos2unix \"{}\" \; 

这将把~/.vim目录下的所有文件转换为unix文件格式。 它应该删除你看到的^M错误。

在你的.vimrc文件中我注意到了

 set ff=unix 

但在vim中,下面的命令解释了一些事情,

 :help dos-file-formats If the 'fileformat' option is set to "dos" (which is the default), Vim accepts a single <NL> or a <CR><NL> pair for end-of-line (<EOL>). When writing a file, Vim uses <CR><NL>. Thus, if you edit a file and write it, Vim replaces <NL> with <CR><NL>. If the 'fileformat' option is set to "unix", Vim uses a single <NL> for <EOL> and shows <CR> as ^M. You can use Vim to replace <NL> with <CR><NL> by reading in any mode and writing in Dos mode (":se ff=dos"). You can use Vim to replace <CR><NL> with <NL> by reading in Dos mode and writing in Unix mode (":se ff=unix"). Vim sets 'fileformat' automatically when 'fileformats' is not empty (which is the default), so you don't really have to worry about what you are doing. 

所以,你应该尝试删除

 set ff=unix 

行,或者修复文件的行尾。

我只是有同样的问题。 在你的bundle文件中调用“dos2unix”的上述解决方案(由nullrevolution提出)应该解决你当前插件的问题。

对于将来,我发现我的问题是由git配置core.autocrlf设置为true克隆git repos到捆绑目录引起的。 在将git config core.autocrlf设置为false后,我再次克隆插件,并返回到UNIX-y文件结尾。