3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ターミナルでgit commitするときに開くエディタがviなのかvimなのかを確認する

Posted at

概要

社内のエンジニアさんたちと会話しているときにneo vimの話になった。「そういやviとvimてどういう関係だっけ?」「git commitするときに開くエディタってviだっけ?vimだっけ?」などの疑問が生まれたので簡単に調べてみた。

viとvimの関係性

viのすべての機能をラップして新しい機能を追加したのがvimって感じ

git commitするときのエディタを調べる

  1. 下記コマンドを実行して$ git commitコマンドを実行したときに開くエディタの設定を確認

    git config --global core.editor
    
  2. viと返ってきたのでviコマンドをつかってgit commitのコミットメッセージ入力をしている事が分かった

$ viコマンドの実態を探る

  1. 下記コマンドを実行してviコマンドの実態をチェック

    which vi
    
  2. /usr/bin/viと返った

  3. 下記を実行してコマンドの実態を探る

    ls -l /usr/bin/vi
    
  4. lrwxr-xr-x 1 root wheel 3 5 4 14:39 /usr/bin/vi -> vimと返った

$ viコマンドは$ vimコマンドのシンボリックリンクになってる模様

結論

自分の環境では$ git commitを実行したときに表示されるときのエディタはvimだった

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?