.gitconfig not following bash alias for default ed

2019-06-21 19:31发布

问题:

In my .bash_profile, I have the vim command aliased to /Applications/MacVim.app/Contents/MacOS/Vim.

For the following line in my .gitconfig file,

 [core]
        editor = vim

git runs system vim rather than following the alias specified above. If I manually change it to match the complete path of MacVim's Vim command above, it works fine.

Is there any way to make .gitconfig follow the bash alias, rather than having to set the complete MacVim path? (I have all my user config files synchronized across multiple machines, some of which don't run MacVim.)

回答1:

Aliases are shortcuts for an interactive shell; they are not used by other processes. Just specify the exact path you want in .gitconfig; you only have to type it once.