6

In GitHub Desktop, is there any way to change the right click "Open in Atom" option, to instead be "Open in Sublime" or some other text editor?

enter image description here

Thanks!

Let'sRefactor
  • 3,303
  • 4
  • 27
  • 43
tnrich
  • 8,006
  • 8
  • 38
  • 59
  • Until they allow that, I'm doing `cmd+T`, then I type in `subl .` — This opens Sublime Text in the current folder if you [have `subl` defined](https://www.sublimetext.com/docs/2/osx_command_line.html) – fregante Mar 28 '16 at 12:36

3 Answers3

4

New answer for GitHub Desktop (Electron)

They finally added an option in the Preferences:

preferences

Old answer for GitHub App Classic (Native)

GitHub looks for /Applications/Atom.app when clicking on "Open in Atom", so you just need to rename your editor to Atom.app, or...

Create a dummy app that opens Sublime. You can download the app that I made with Automator or make one yourself:

  1. In Automator, select Application
  2. Add the action Run Shell Script
  3. Select As arguments in the Pass input dropdown
  4. Enter this: /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl "$@"
  5. Save it as Atom in the Applications folder.

Expected Automator file

Now "Open in Atom" should simply "Open in Sublime Text"

fregante
  • 29,050
  • 14
  • 119
  • 159
  • Oh my... so easy! The App icon needs to be changed too, but that's optional. Also harder. –  Apr 28 '16 at 12:31
  • Change Icon, see [here](http://apple.stackexchange.com/questions/369/can-i-change-the-application-icon-of-an-automator-script#answer-370) and refresh app icon in Launchpad & Doc, see [here](https://gist.github.com/fabiofl/5873100#gistcomment-1406760) –  Apr 28 '16 at 12:45
  • Okay. This is great. Thanks for the tip! – Don Jul 31 '16 at 00:21
  • 1
    This also works if you are using Visual Studio Code. Just change to the following -- `/Applications/Visual\ Studio\ Code\ -\ Insiders.app/Contents/MacOS/Electron "$@"` (modify to point to your VSS app). – Valien Apr 19 '17 at 14:25
1

You can't, as it seems to be a part of app's menu. However, you can set your default editor in global config like

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

For more, refer Associating text editors with Git

Let'sRefactor
  • 3,303
  • 4
  • 27
  • 43
  • 1
    Hmm, interesting idea. I tried following the instructions on the page you linked to: `git config --global core.editor "subl -n -w"`, restarted github desktop, but to no avail. – tnrich Jan 06 '16 at 08:14
1

on Windows with portable Sublime Text editor.

You need to create a registry key with a path to a folder where subl.exe file is. This is the absolute minimum (of valunames) for the key:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sublime Text 3_is1]
"Publisher"="Sublime HQ Pty Ltd"
"DisplayName"="Sublime Text 3"
"InstallLocation"="C:\\Apps\\YOUR\\PATH\\TO\\Sublime\\"
"Comment"="This key is needed for Github to detect SublimeText"

valuename Comment is not needed. I added it for myself to remember what's this key about.

This is the registry location for Uninstall info. But because I removed most of the valuenames which original Sublime installation creates, Windows Uninstall will not show this as an entry to remove in Uninstall.

papo
  • 1,606
  • 19
  • 18
  • This answer is incredibly useful for adding your own entries to the menu even when using portable apps. You can find the other natively supported options and their required registry key names by browsing the source file here https://github.com/desktop/desktop/blob/development/app/src/lib/editors/win32.ts – Shenk Mar 20 '21 at 19:32