gVim showing carriage return (^M) even when file mode is explicitly DOS

前端 未结 10 1482
小蘑菇
小蘑菇 2020-12-22 15:25

I\'m using gVim on Windows. My code shows ^M characters at the end of lines. I used :set ff=dos to no avail. The ^M characters remain

10条回答
  •  清歌不尽
    2020-12-22 16:14

    These are extra CR line endings usually because of a using a file on mixed UNIX/DOS systems.

    Possible the shortest answer to remove a single ^M from the end of each line, and what I use, is:

    :%s/\r
    

    which is equivalent to:

    :%s/\r//
    

    but the end slashes aren't required (they're assumed).

提交回复
热议问题