windows 使 Sublime Text 成为我的核心编辑器的命令是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7594091/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the command to make Sublime Text my core editor?
提问by Chris Wildman
So I'm trying to set up GitHub for the first time ever and I want Sublime Text to be my core editor, how exactly do I do that? Sorry if this is a noob question, I am a noob :/
所以我第一次尝试设置 GitHub,我希望 Sublime Text 成为我的核心编辑器,我该怎么做?对不起,如果这是一个菜鸟问题,我是菜鸟:/
采纳答案by CharlesB
Enter this command in a prompt:
在提示中输入此命令:
git config --global core.editor "C:/Program Files/Sublime Text 2/sublime_text.exe"
It will then pop up when prompted for a commit message, or any other edition task, but if it was already open it won't work since it uses the same instance. Don't know how to workaround this.
然后它会在提示提交消息或任何其他编辑任务时弹出,但如果它已经打开,它将无法工作,因为它使用相同的实例。不知道如何解决这个问题。
回答by Ted Avery
As this ranked highly when I was searching Google for Mac instructions, here is a combination of solutions I found.
由于在我搜索 Google for Mac 说明时排名很高,因此这里是我找到的解决方案组合。
First I set up a command line utility matching "subl" to Sublime Text from any terminal instance with this terminal command.
首先,我使用此终端命令从任何终端实例设置了一个将“subl”与 Sublime Text 匹配的命令行实用程序。
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
Then I do a similar git config command to the Windows solution above, but with a -w parameter at the end.
然后我对上面的 Windows 解决方案执行了一个类似的 git config 命令,但最后有一个 -w 参数。
git config --global core.editor "subl -w"
回答by codeBreath
Since build 3010 of Sublime Text 3, the subl.exe helper is included by default. So, combining CharlesB and Ted's answers gives you the best answer --
从 Sublime Text 3 的 build 3010 开始,默认情况下包含 subl.exe 帮助程序。所以,结合 CharlesB 和 Ted 的答案给你最好的答案——
type in a prompt (cmd.exe or git_bash):
输入提示(cmd.exe 或 git_bash):
setx SUBLIME c:\path\to\sublime\install\dir git config --global core.editor "subl.exe -w"
setx SUBLIME c:\path\to\sublime\install\dir git config --global core.editor "subl.exe -w"
Note the presence/absence of quotes. git config requires them, whereas setx does NOT. Also, while you're at it, try using a path\to\sublime that doesn't use spaces. That way you can use this with both MSysGit and Cygwin Git.
注意引号的存在/不存在。git config 需要它们,而 setx 不需要。此外,当您在使用它时,请尝试使用不使用空格的 path\to\sublime。这样你就可以在 MSysGit 和 Cygwin Git 中使用它。
回答by liamvictor
I had to manually edit the .gitconfig
file in my user directory within Windows. The editor required single quotes around it, like so:
我不得不手动编辑.gitconfig
Windows 用户目录中的文件。编辑器需要用单引号将其括起来,如下所示:
[core]
editor = 'C:/Program Files/Sublime Text 3/sublime_text.exe'