Active7 months ago
I have a problem setting Sublime Text 2 as the
core.editor
with git
.- This is the simplest method of setting Notepad++ as the default editor. The other methods include changing the registry settings within Windows or changing the default application setting within application properties.
- To change this, one of the ways to do this is to resort to change the default text editor by accessing the Get Info menu. Here’s how to do it: Here’s how to do it: First, right-click on the document and a drop down menu will appear.
- This change to the default Git text editor was specified to take place at the global Git scope, so the change can be inspected by opening the.gitconfig file found under the user’s home directory. Upon inspection, you will note that a new core heading has been added to the Git configuration file and the editor property has been set to Notepad++.
I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows.
I have done:
By configuring git config core.editor notepad, users can now use notepad.exe as their default editor. Configuring git config format.commitMessageColumns 72 will be picked up by the notepad wrapper and line-wrap the commit message after the user edits it.
and tried that with various arguments like
-m
. When I open my .gitconfig
, this is what is in there:If I go to Git and type:
the README file opens in Notepad, not Sublime Text.
Does anyone have any idea what I'm doing wrong or how I could fix this?
Spencer MoranSpencer Moran1,09522 gold badges99 silver badges1212 bronze badges
15 Answers
Windows
Sublime Text 2 (Build 2181)
The latest Build 2181 just added support for the
-w
(wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such.Sublime Text 3 (Build 3065)
Sublime Text 3 (Build 3065) added the
subl.exe
command line helper. Use subl.exe -h
for the options available to you. I have hot_exit: true
and remember_open_files: true
set in my Sublime Text user settings. I have found the following to git config to work well for me.Mac and Linux
Set Sublime as your editor for Git by typing the following command in the terminal:
git config --global core.editor 'subl -n -w'
With this Git config, the new tab is opened in my editor. I edit my commit message, save the tab (Ctrl+S) and close it (Ctrl+W).
Git will wait until the tab is closed to continue its work.
chicks1,66322 gold badges1616 silver badges3131 bronze badges
jrotellojrotello3,88111 gold badge1616 silver badges1515 bronze badges
fedorqui182k5757 gold badges377377 silver badges420420 bronze badges
sfufoetsfufoet
For Mac OS X in the file ~/.gitconfig under [core] I had to put this code to solve the issue on my end.
This was when subl was working fine but git was unable to access it. And was displaying these errors
Ahmad AwaisAhmad Awais14k33 gold badges4949 silver badges4343 bronze badges
For Mac & Sublime Text 3:
If
git config --global core.editor 'subl -n -w'
doesn't work, use this git config
command:Note: it does not contain escaping backslashes.
nu-bonu-bo
what worked for me in cygwin/zsh:
in /usr/local/bin create subl_git file
in gitconfig:
meeechmeeech
With Sublime Text 2 and the following configuration, if nothing happens when you close the git commit's comment file :
If the git commit doesn't finish when you close the COMMIT_EDITMSG comment file in Sublime, I've found this is probably because you are running CMD in administrator mode (and have a Sublime Text already opened in non admin mode). I had the same problem and it worked for me when I started my CMD in normal mode.
Ps : just wanted to answer to the problem @david pointed out in the accepted answer's comments, but I couldn't post comment since I'm new here... so I've made a new answer, because I think this can be useful to some people encountering the problem.
FrancoisFrancois
I just successfully made it with the help of PowerShell (command line tools for windows, which is also be use as the default command line on GithubforWindows)
Just make a folder 'WindowsPowerShell' on 'C:Users%username%My Documents'.Then, create a file called 'profile.ps1'.Make sure that you have the correct file extension, .ps1 and not .txt.inside the profile.ps1, put this line to set an alias command:
Make sure the sublime directory on your machine is correct.You can also see the configuration details in here.
Now, I can edit files with Sublime Text 2 via PowerShell command just by typing:
Hopefully this is usefull...
rwinzhangrwinzhang
I've faced the same problem with git editor in Windows this evening, and finally I've got it.
You'll need to set your editor path with the bash syntax and using the DOS 8.3 format to avoid spaces:
This doesn't work (for me):
This do:
You can get the DOS 8.3 name for a directory with dir /x
Diego BuendiaDiego Buendia
I was just struggling with this for some reason, none of the examples above quite worked for me. This was my solution however:
You specifically need the
' '
around the path and the $*
at the end of the args, all in ' '
.justin.m.chasejustin.m.chase
8,55055 gold badges3434 silver badges7373 bronze badges
mainframermainframer9,28988 gold badges3535 silver badges5757 bronze badges
well, i had some trouble invoking notepad++ from gitbash even after setting it as my core.editor.
i got it all solved by appending the below line to my .bashrc file in my gitbash installation directory.
so, i can invoke notepad++ with the alias 'npp'. i feel this can help you if you change the directory to the respective editor you want to use.
OLATOMIDEOLATOMIDE
For MAC Users I can say for Sublime use the following:
First Check the .gitconfig file using command:
cd ~
ls -la
cat .gitconfig
Now one can add this configuration:
Where
fedorquil1
will tell to start at line 1.182k5757 gold badges377377 silver badges420420 bronze badges
bvmCoderbvmCoder
For Windows 7 I have found the following solution works:
tscott1tscott1
Text Editor For Windows
On Windows, if you are installing git, you can select other editor and give the following command line.C:Program FilesSublime Text 3sublime_text.exe -w
Xavier JohnXavier John3,92833 gold badges2020 silver badges2727 bronze badges
I haven't seen any instances of updates regarding Windows allowing Git installation to actively pick Sublime Text as your default text editor without all the sturm und drang of the original override codes...
AngelfirenzeAngelfirenze
Not the answer you're looking for? Browse other questions tagged giteditordefaultsublimetextgit-config or ask your own question.
Active7 months ago
I have a problem setting Sublime Text 2 as the
core.editor
with git
.I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows.
I have done:
and tried that with various arguments like
-m
. When I open my .gitconfig
, this is what is in there:If I go to Git and type:
the README file opens in Notepad, not Sublime Text.
Does anyone have any idea what I'm doing wrong or how I could fix this?
Spencer MoranSpencer Moran1,09522 gold badges99 silver badges1212 bronze badges
15 Answers
Windows
Sublime Text 2 (Build 2181)
The latest Build 2181 just added support for the
-w
(wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such.Sublime Text 3 (Build 3065)
Sublime Text 3 (Build 3065) added the
subl.exe
command line helper. Use subl.exe -h
for the options available to you. I have hot_exit: true
and remember_open_files: true
set in my Sublime Text user settings. I have found the following to git config to work well for me.Mac and Linux
Set Sublime as your editor for Git by typing the following command in the terminal:
git config --global core.editor 'subl -n -w'
With this Git config, the new tab is opened in my editor. I edit my commit message, save the tab (Ctrl+S) and close it (Ctrl+W).
Git will wait until the tab is closed to continue its work.
chicks1,66322 gold badges1616 silver badges3131 bronze badges
jrotellojrotello3,88111 gold badge1616 silver badges1515 bronze badges
fedorqui182k5757 gold badges377377 silver badges420420 bronze badges
sfufoetsfufoet
For Mac OS X in the file ~/.gitconfig under [core] I had to put this code to solve the issue on my end.
This was when subl was working fine but git was unable to access it. And was displaying these errors
Ahmad AwaisAhmad Awais14k33 gold badges4949 silver badges4343 bronze badges
For Mac & Sublime Text 3:
If
git config --global core.editor 'subl -n -w'
doesn't work, use this git config
command:Note: it does not contain escaping backslashes.
nu-bonu-bo
what worked for me in cygwin/zsh:
in /usr/local/bin create subl_git file
in gitconfig:
meeechmeeech
With Sublime Text 2 and the following configuration, if nothing happens when you close the git commit's comment file :
If the git commit doesn't finish when you close the COMMIT_EDITMSG comment file in Sublime, I've found this is probably because you are running CMD in administrator mode (and have a Sublime Text already opened in non admin mode). I had the same problem and it worked for me when I started my CMD in normal mode.
Ps : just wanted to answer to the problem @david pointed out in the accepted answer's comments, but I couldn't post comment since I'm new here... so I've made a new answer, because I think this can be useful to some people encountering the problem.
FrancoisFrancois
I just successfully made it with the help of PowerShell (command line tools for windows, which is also be use as the default command line on GithubforWindows)
Just make a folder 'WindowsPowerShell' on 'C:Users%username%My Documents'.Then, create a file called 'profile.ps1'.Make sure that you have the correct file extension, .ps1 and not .txt.inside the profile.ps1, put this line to set an alias command:
Make sure the sublime directory on your machine is correct.You can also see the configuration details in here.
Now, I can edit files with Sublime Text 2 via PowerShell command just by typing:
Hopefully this is usefull...
rwinzhangrwinzhang
How To Set Default Text Editor Mac
I've faced the same problem with git editor in Windows this evening, and finally I've got it.
You'll need to set your editor path with the bash syntax and using the DOS 8.3 format to avoid spaces:
This doesn't work (for me):
This do:
You can get the DOS 8.3 name for a directory with dir /x
Diego BuendiaDiego Buendia
I was just struggling with this for some reason, none of the examples above quite worked for me. This was my solution however:
You specifically need the
justin.m.chasejustin.m.chase' '
around the path and the $*
at the end of the args, all in ' '
.8,55055 gold badges3434 silver badges7373 bronze badges
mainframermainframer9,28988 gold badges3535 silver badges5757 bronze badges
well, i had some trouble invoking notepad++ from gitbash even after setting it as my core.editor.
i got it all solved by appending the below line to my .bashrc file in my gitbash installation directory.
so, i can invoke notepad++ with the alias 'npp'. i feel this can help you if you change the directory to the respective editor you want to use.
OLATOMIDEOLATOMIDE
For MAC Users I can say for Sublime use the following:
First Check the .gitconfig file using command:
cd ~
ls -la
cat .gitconfig
Now one can add this configuration:
Where
fedorquil1
will tell to start at line 1.182k5757 gold badges377377 silver badges420420 bronze badges
bvmCoderbvmCoder
For Windows 7 I have found the following solution works:
tscott1tscott1
On Windows, if you are installing git, you can select other editor and give the following command line.C:Program FilesSublime Text 3sublime_text.exe -w
Xavier JohnXavier John3,92833 gold badges2020 silver badges2727 bronze badges
I haven't seen any instances of updates regarding Windows allowing Git installation to actively pick Sublime Text as your default text editor without all the sturm und drang of the original override codes...
AngelfirenzeAngelfirenze