Reputation: 203
I have recently installed cygwin (as I am confined to a Windows OS) and would like to utilize Vim within it. Everything is installed and I can access vim readily and can modify .vimrc and the like. From a prior post, I have learned that my plugins must be in vimfiles for a Windows OS and have done so. However, now when I try to verify pathogen I get an error stating:
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
My .virmc (again very basic as just trying to start everything up)
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
Regards,
Upvotes: 4
Views: 2326
Reputation: 2328
I just had the same problem. The above solution (proposed by nullrevolution) of calling "dos2unix" on your bundle files should fix your problem for the current plugins.
For the future, I found my problem was was caused by cloning git repos into the bundles directory with git config core.autocrlf set to true. After I set the git config core.autocrlf back to false, I git cloned the plugins again, and it was back to UNIX-y file endings.
Upvotes: 0
Reputation: 4117
from the shell, try executing the following command:
find ~/.vim -type f -exec dos2unix \"{}\" \;
this will convert all files under your ~/.vim
directory into unix file format. it should remove the ^M
errors you're seeing.
Upvotes: 3
Reputation: 9
In your .vimrc file I notice
set ff=unix
But in vim the following commands explain some things,
: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.
So, you should try to remove the
set ff=unix
line, or fix the end of lines of your file.
Upvotes: 0