在命令行中,如果我执行 mate <filepath>
它会在 TextMate 中为我打开正确的文件。
但是当我这样做的时候:
$ mate -v
open: invalid option -- v
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
另外,当我做 git commit
,我看到了这个:
$ git commit
error: cannot run mate: No such file or directory
error: There was a problem with the editor 'mate'.
Please supply the message using either -m or -F option.
我的 ~/.bashprofile
有这些行:
#Set Textmate as my default editor from the command-line
alias mate='open -a TextMate.app'
export EDITOR="/usr/local/bin/mate -w"
和~/.bashrc
只有这个:
alias mate='open -a TextMate.app'
编辑 1
我的 ~/.gitconfig
包括以下内容:
[user]
name = My Name
email = myemail@address.com
[core]
editor = mate
[github]
user = marcamillion
token = 50e3iuaidsgadjkhwkjegakjhbsdkjb30432 (don't worry, this is fake)
帮助!
最佳答案
The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order).
假设配合路径正确,配置它的简单方法是运行
git config --global core.editor "/usr/local/bin/mate -w"
当然,假设您可以运行 /usr/local/bin/mate -w
。通过与您的本地用户一起运行 /usr/local/bin/mate -w
来检查。如果找不到,您可以使用 which mate
来查找它(如果它根本不存在于您的路径中) - 如果不存在,我认为您需要使用您拥有的表格您的别名(open -a TextMate.app -w
)。
编辑:将评论 merge 到答案中。
关于git - 我如何让 git 使用 Textmate 作为我的默认编辑器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12210998/