LoginSignup
17
18

More than 5 years have passed since last update.

Vimで改行コードCRをLFに、%s/^M/^M/gで置換する

Last updated at Posted at 2015-06-08

Vim (or MacVim)で改行コードがCRのファイルを開くとこんな感じになってしまう。

スクリーンショット 2015-06-08 14.51.22.png

以下のコマンドでLFに置換できる。
:%s/^M/^M/g

スクリーンショット 2015-06-08 14.52.35.png
スクリーンショット 2015-06-08 14.52.40.png

^Mは Ctrl+V,Ctrl+M で入力できる。

恒等変換っぽいコマンドなのにCR->LFの変換ができて気持ち悪い

17
18
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
18