Prakhar
Prakhar

Reputation: 3536

Error Trailing Characters in Ubuntu

I'm trying to set up my VIMRC (gvim on Ubuntu 11.10)file which contains just 2 lines (as of now)

set ruler
set number

I keep getting this error:

line 1:
E488: Trailing characters: number^M 
line  2: 
E488: Trailing characters: ruler^M

How do I resolve this?

Upvotes: 15

Views: 10698

Answers (2)

sixtyfootersdude
sixtyfootersdude

Reputation: 27231

Open the vimrc file in vim (this will probably work with errors. If it doesn't then move _vimrc to myVimrc):

vim _vimrc

Then run this ex command:

:set fileformat=unix

Dos2Unix didn't work for me. I think that dos2unix only works with ANSI files.

dos2unix <file> 

Upvotes: 11

jcollado
jcollado

Reputation: 40384

As pointed out by the comment, it seems that you've got some \r characters from a windows configuration. To solve this use:

dos2unix <file>

Upvotes: 15

Related Questions