vim 中如何取代特殊字元^M

出至:http://stackoverflow.com/questions/5939142/replacing-m-with-enter

Replacing ^M with Enter

I know how to remove ^M in my files (%s/^M//g), but this one is just one line I’d like to replace ^M with enter… what’s the enter character in VIM (to use in commnad-line mode).

You can replace one character using r<CR> in normal mode.
Or you can enter a “return" in command line mode by typing <C-v><CR>.

一般模式下取代一個字元,直接用「r<CR>」。<CR>是Enter鍵的意思!

或是在命令列模式中先按下「Ctrl+V」就會出現「^」字元,接著再按下「Enter」就能順利打出「^M」這個符號了。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s