Skip to content

Instantly share code, notes, and snippets.

@sandheepg
Created March 8, 2017 07:15
Show Gist options
  • Select an option

  • Save sandheepg/2e77a266a5b114bf43a7a93b2ee65306 to your computer and use it in GitHub Desktop.

Select an option

Save sandheepg/2e77a266a5b114bf43a7a93b2ee65306 to your computer and use it in GitHub Desktop.
Add sublime text option to contextual menu

After installing sublime text, we must be able to open text files with it. Right click on a text file and you must see the option "open with sublime text". In case you don't, click Open with other applications and you should see Sublime text option there. No luck yet, here are the troubleshooting steps.

# open the .desktop file for sublime
sudo sublime /usr/share/applications/sublime.desktop

# add the below lines to the file

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime %f
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

This adds Open with Sublime text in right click context menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment