LoginSignup
2

More than 5 years have passed since last update.

MacとWinそれぞれでgit関連の編集をvim→sublimeに変更する

Last updated at Posted at 2017-08-22

自分はsublimeが好きなので(というか他の用途と合わせて1つのエディタに集約したい&sublime内のタブでターミナルを起動させられるようにしてるので),コミットメッセージ修正(git commit --amend)などでもvimではなくsublimeに出来るように以下のように設定しました。

■Macのやり方

※ターミナルから「subl」でsublime text3を起動させられるようになっている前提
(そのやり方はこことか見るとできます)

下記を実行

git config --global core.editor "subl -n -w"

■Winのやり方

※sublimeのPathはそれぞれどこにインストールしているか確認して修正してください。
自分の場合は下記にインストールされていました。

下記を実行

※「subl」でsublime text3を起動させられるようになっていないはこっち

git config --global core.editor "'C:\Program Files\Sublime Text 3/sublime_text.exe' -w"

※「subl」でsublime text3を起動させられるようになっている人はこっち
やり方はこことか見るとできます)

git config --global core.editor "'subl' -w"

試しにgit logが存在する状態で「git commit --amend」と実行したときにvimではなくsublimeが起動されればOK。ふつーに編集&保存で適用される。

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
2