Vim: \n vs. \r

unix, vim, windows

Solution

Lookup up:

:set fileformat=unix
:set fileformat=dos

This can be used on either platform to switch to the other encoding.

Problem

I haven't used vim in a Unix system in a while, but as I recall there was no \r, it was always \n. I'm using gVim under windows and when I search for new line characters I use \n. Searching for \r returns nothing. But when I replace the characters I have to use \r's. \n's give me ^@ Can anyone explain what's going on here?

Original source