kien / ctrlp.vim

Fuzzy file, buffer, mru, tag, etc finder.
kien.github.com/ctrlp.vim
7.26k stars 676 forks source link

Control-M (^M) error while opening vim over cygwin #620

Open anoopelias opened 9 years ago

anoopelias commented 9 years ago

Hi, I am trying to load ctrlp over cygwin,

I downloaded the bundle, updated the .vimrc and then open vim, I get the following error,

$ vim
Error detected while processing /home/Anoop.Elias/.vim/bundle/ctrlp.vim/plugin/ctrlp.vim:
line    7:
E492: Not an editor command: ^M
line    8:
E15: Invalid expression: ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp^M
line   15:
E475: Invalid argument: ^M g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]^M = [[], [], [], [], {}, {}, [], 2]^M
line   69:
E171: Missing :endif
Press ENTER or type command to continue

Needless to say CtrlP doesn't work once vim is opened.

Shougo commented 9 years ago

It is not ctrlp problem. You must convert files line format.

anoopelias commented 9 years ago

Tried this,

$ dos2unix .vim/bundle/ctrlp.vim/plugin/ctrlp.vim
dos2unix: converting file .vim/bundle/ctrlp.vim/plugin/ctrlp.vim to Unix format...

Got something like the below, (The error goes on for about 100-200 lines, I pasted only the last part. But it is similar)

E492: Not an editor command: ^M
line  114:
E488: Trailing characters
line  119:
E492: Not an editor command: ^M
line  120:
E488: Trailing characters
line  124:
E492: Not an editor command: ^M
line  125:
E488: Trailing characters
line  128:
E492: Not an editor command: ^M
line  129:
E488: Trailing characters
line  132:
E492: Not an editor command: ^M
line  133:
E488: Trailing characters
line  140:
E492: Not an editor command: ^M
line  141:
E488: Trailing characters
line  153:
E492: Not an editor command: ^M
Error detected while processing /home/Anoop.Elias/.vim/bundle/ctrlp.vim/plugin/ctrlp.vim:
line   40:
E117: Unknown function: ctrlp#mrufiles#init
Press ENTER or type command to continue

Is there anything else, I can try?

anoopelias commented 9 years ago

Further,

I tried to convert the file back using unix2dos command and the original error comes back,

$ unix2dos ctrlp.vim
unix2dos: converting file ctrlp.vim to DOS format...

$ vim
Error detected while processing /home/Anoop.Elias/.vim/bundle/ctrlp.vim/plugin/ctrlp.vim:
line    7:
E492: Not an editor command: ^M
line    8:
E15: Invalid expression: ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp^M
line   15:
E475: Invalid argument: ^M g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]^M = [[], [], [], [], {}, {}, [], 2]^M
line   69:
E171: Missing :endif
Press ENTER or type command to continue
laszukdawid commented 7 years ago

I had exactly the same problem, but on vanilla Ubuntu 16.04. My solution was to disable git automatic end line conversion with git config --global core.autocrlf false before running git clone. I am not sure where the problem lays, but can imagine its both in non-consistency in ctrlP package and git going stupid with some edge cases.