Last active
May 21, 2024 12:52
-
-
Save S3ak/10427958 to your computer and use it in GitHub Desktop.
How to set git commit editor to sublime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Method 1 | |
git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w" | |
Method 2 | |
git config --global core.editor "subl -n -w" | |
Method 3 | |
$ echo 'alias subl="/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"' >> ~/.bashrc |
prior solutions didn't work, so here's what worked for me—
OS: macOS 14.4 23E214 arm64
Shell: zsh 5.9
CPU: Apple M2
Editor: Sublime Text 4 (Build 4169)
check out Table 4 in section git config core.editor commands for an exhaustive list of core.editor
configuration commands (Pro Git 2nd Ed. Appendix C). looks helpful for other system / editor combinations, too.
solution in my case:
$ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"
(source link and git blame in the book)
specifying the path to the macOS executable sublime_text
as @kitmw mentioned (thank you for the quick name check how-to) did not behave as expected:
2024-03-22 21:44:48.432 sublime_text[45060:2846253] WARNING: -restoreStateWithCoder: called with an
unsupported NSCoder.
It works on my mac. Thank you @xsqf !
macOS 13.5 Shell: zsh 5.9 CPU: Apple M2 Editor: Sublime Test 4
$ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm on Sublime Text build no 4126 (up to date as of now) on mac and the executable name seems to have changed to sublime_text (rather than Sublime Text). You can check yours by going to the applications folder and right click, show package contents. The upshot is the following worked for me:
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/sublime_text"