git commit の editor もSublime Textにしようとしたもののすんなり行かなかったのでメモ。
すんなり行かなかった理由は rbenv
を入れていたから。
subl をインストール
Ruby Envのディレクトリを~/.rbenv/
と命名していたのでここの下にbinをディレクトリを作成する。
続いて次のコマンドを入力することでSublime Text
のコマンドラインツールであるsublが入る。
$ ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/.rbenv/bin/subl
するとsublというファイルができあがる。
$ subl —help
と入力してインストールされたか確認すると…
Sublime Text build 3083 Usage: subl [arguments] [files] edit the given files or: subl [arguments] [directories] open the given directories or: subl [arguments] - edit stdin Arguments: --project <project>: Load the given project --command <command>: Run the given command -n or --new-window: Open a new window -a or --add: Add folders to the current window -w or --wait: Wait for the files to be closed before returning -b or --background: Don't activate the application -s or --stay: Keep the application activated after closing the file -h or --help: Show help (this message) and exit -v or --version: Show version and exit --wait is implied if reading from stdin. Use --stay to not switch back to the terminal when a file is closed (only relevant if waiting for a file). Filenames may be given a :line or :line:column suffix to open at a specific location.
と出る。
これでinstallは完了。
gitに設定
改めてgit configに設定してあげる。
$ git config --global core.editor "subl -n -w"
git commit するとsublが立ち上がり、このtab/windowを close すると
commitが完了する。