Jan 29 2008

vim tip of the day

Published by Brian at 8:14 am under vim

Vim is a great editor. I don’t want to start an EMACS versus vim flame war here. It is just personal preference: I “get” vim, whereas EMACS confuses me.

Anyway, here’s a clever little tip for users of vim that often have to open both DOS and UNIX format files (you know, the old ^M line feed problem):

While in the editor you can write out either format.

:set ff=unix
:w

Sets the file to UNIX linefeeds, while

:set ff=dos
:w

Sets them to DOS. Enjoy!

2 Responses to “vim tip of the day”

  1. Tom Arayaon 29 Jan 2008 at 9:56 am

    In vi:

    :%s!^M!!g’

    That is all.

  2. Brianon 06 Feb 2008 at 11:14 am

    Wouldn’t that remove the linefeed instead of replacing it with the right one?

Trackback URI | Comments RSS

Leave a Reply