LoginSignup
27
23

More than 5 years have passed since last update.

Emacsでコードを垂直方向に揃えたい

Posted at

【翻訳】私がコーディングで垂直方向にそろえるインデントをとる理由という記事を読んで、自分も早速コードを垂直に揃えるようにし始めたが自動でやるのは非生産的過ぎるので、Emacsで簡単に行える方法を調べました。

M-x align-regexp を使う

以下のようなコードを垂直に揃えたいとします。

スクリーンショット 2015-01-26 20.27.45.png

json.result ~ image.updated_atまでを範囲選択します。

スクリーンショット 2015-01-26 20.28.26.png

次にM-x align-regexp コマンドを実行して、どの文字を基準にして縦を揃えるかを決めます。今回の場合はspaceなのでspaceを押して、Enterを押します。
すると綺麗に縦に並びます。

スクリーンショット 2015-01-26 20.28.41.png

これで、楽して綺麗なコードの出来上がり!

27
23
0

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
27
23