LoginSignup
19
14

More than 5 years have passed since last update.

CotEditor を git のエディタとして使用する

Last updated at Posted at 2016-05-17

コマンドライン経由で git を操作するとき、使い慣れない emacs や vim などのエディタを使うのは疲れますよね。
そういうときでも CotEditor を使えるようにする方法です。

cot コマンドのインストール

まず、CotEditor のコマンドラインツールである cot をインストールする。
homebrew 経由でインストールする方法とシンボリックリンクを通す方法がある(個人的にはシンボリックリンクの方がオススメ1)。

homebrew

$ brew tap coteditor/coteditor
$ brew install cot

シンボリックリンク

$ ln -s /Applications/CotEditor.app/Contents/SharedSupport/bin/cot /usr/local/bin/cot

git の EDITOR に指定

git で使用するエディタとして cot コマンドを指定する。

$ git config --global core.editor "cot -w"

-w オプションを指定するとウインドウを閉じるまでプロンプトを返すのを待ってくれます。忘れないように。

使い方

これで git rebase -i などの作業をするときに CotEditor が立ち上がるようになります。

Screen Shot 2016-05-17 at 14.34.35.png

編集が終わったら保存をしてウインドウを閉じると編集結果が反映されます。

git コミットもシンタックスハイライトされればいいのにね!2



  1. 実は両者は CotEditor.app の探し方に違いがあり、.app にバンドルされてる cot にシンボリックリンクを張った方が直接親の CotEditor を起動するので起動が若干速い。 

  2. まぁ、こんどやります。 → CotEditor 2.5.5 で入れたよ 

19
14
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
19
14