Vim: \n vs. \r

后端 未结 8 1203
小鲜肉
小鲜肉 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

    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.

提交回复
热议问题