[NBLUG/talk] vim fileformat

Ross Thomas boscorama at fastmail.us
Mon Sep 11 14:17:41 PDT 2006


On Mon, 11 Sep 2006 13:42:27 -0700, "Barry Stump"
<barry.stump at gmail.com> said:
> 
> I know that I can use
> :set fileformat=dos
> to change the file format, but because of source control, I can't just
> save the file and reload it to see the changes.  How do I get vim to
> change the format and re-process the buffer in place so that the
> display of the ^M characters go away without changing the actual file?
>  Alternatively, a vim command line parameter to force it to read the
> file as a certain format would also work, if such a thing exists.
> 
> Anyone know any vim magic that can help?

Sounds like you cannot change the file itself and are just viewing
it using vim.  Correct?  Well, the easiest way to fix this is to remove
those trailing ^M chars from the current buffer like this:
   :%s/\r$//

If you use it enough you can define it as a macro or a vim buffer
initializer in your .vimrc file.

HTH

Ross.

-- 
http://www.fastmail.fm - I mean, what is it about a decent email service?




More information about the talk mailing list