Vim: \n vs. \r

后端 未结 8 840
小鲜肉
小鲜肉 2020-12-23 17:40

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

相关标签:
8条回答
  • 2020-12-23 18:18

    Lookup up:

    :set fileformat=unix
    :set fileformat=dos
    

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

    0 讨论(0)
  • 2020-12-23 18:18

    vim does some messing around with carriage returns (\r) and newlines (\n). For instance, if you're in Unix and vi shows you lines ending in '^M' because they're Windows text files, an easy way to get rid of them is to enter the command

    :%s/^V^M/^V^M/g
    

    It doesn't look like it should do anything, but it does.

    0 讨论(0)
提交回复
热议问题