开发者

What is the command to make Sublime Text my core editor?

开发者 https://www.devze.com 2023-04-09 00:02 出处:网络
So I\'m trying to set up GitHub for the first time ever and I want Sublime Text to be my co开发者_JS百科re editor, how exactly do I do that? Sorry if this is a noob question, I am a noob :/As this ran

So I'm trying to set up GitHub for the first time ever and I want Sublime Text to be my co开发者_JS百科re editor, how exactly do I do that? Sorry if this is a noob question, I am a noob :/


As this ranked highly when I was searching Google for Mac instructions, here is a combination of solutions I found.

First I set up a command line utility matching "subl" to Sublime Text from any terminal instance with this terminal command.

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.

git config --global core.editor "subl -w"


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.


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

type in a prompt (cmd.exe or git_bash):

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.


I had to manually edit the .gitconfig file in my user directory within Windows. The editor required single quotes around it, like so:

[core]
        editor = 'C:/Program Files/Sublime Text 3/sublime_text.exe'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号