I am seeing a lot of ^M symbols in my file. I tried setting the
‘fileformat’ option to ‘dos’ and then ‘unix’ and then ‘mac’. None of these helped. How can I hide these symbols? When a file is loaded in Vim, the format of the file is determined as below: - If all the lines end with a new line (<NL>), then the fileformat is ‘unix’. - If all the lines end with a carriage return (<CR>) followed by a new line (<NL>), then the fileformat is ‘dos’. - If all the lines end with carriage return (<CR>), then the fileformat is ‘mac’. If the file has some lines ending with <CR> and some lines ending with <CR> followed by a <NL>, then the fileformat is set to ‘unix’. You can change the format of the current file, by saving it explicitly in dos format:
:w ++ff=dos
To display the format of the current file, use
:set fileformat?
The above behavior is also controlled by the ‘fileformats’ option. You can try the following commands:
:set fileformats+=unix
:e
:set fileformat=unix
:w
To remove the carriage return (<CR>) character at the end of all the lines in the current file, you can use the following command:
:%s/\r$//
To force Vim to use a particular file format, when editing a file, you can use the following command:
:e ++ff=dos filename
23.1 ++ff
Comments (1)
Pepsh Pepshinsky
Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE