Reese Knowledgebase

Setting file formats in VIM

View Kristian Reese's profile on LinkedIn


If you like this article, please +1 or Recommend via FB with the provided buttons above:

Article ID: 43
by: Reese K.
Posted: 11 Jul, 2012
Last updated: 11 Jul, 2012
Views: 1015

Sometimes, my scripts will be in DOS format with that pesky CR (Carriage Return) ^M charater and the end of each line.  A simple way to rid your file of it is to set the file format in a vim session as follows:

:set ff=unix

Otherwise, the ^M can be created by depressing the ctrl-v+m key combo (keep ctrl held down for both key presses of v and m), and you can do a substitution.

Here's a cool wiki on end of line formats.

http://vim.wikia.com/wiki/Change_end-of-line_format_for_dos-mac-unix

This article was:   Helpful | Not Helpful
Prev   Next
Use nmap to scan network     Various tar/gzip one liners

RSS