How do I make Git use the editor of my choice for commits?

后端 未结 27 2119
庸人自扰
庸人自扰 2020-11-22 01:33

I would prefer to write my commit messages in Vim, but it is opening them in Emacs.

How do I configure Git to always use Vim? Note that I want to do this globally,

27条回答
  •  醉酒成梦
    2020-11-22 01:54

    For users of TextWrangler from the Mac app store:

    git config --global core.editor "open -n -W -a TextWrangler"
    

    Also, make sure your "TextWrangler > Preferences > Application > When TextWrangler becomes active:" setting is set to "Do nothing"

    This works for me on OS X 10.11.4 with TextWrangler 5.0.2 from the Mac app store.

    Explanation:

    The -n means open in a new instance.

    The -W means to wait until the application exits before using the contents of the edited file as the commit message.

    The -a TextWrangler means use the TextWrangler application to open the file.

    See man open in your Mac Terminal app for more details.

提交回复
热议问题