Install Sublime Text 2 in Ubuntu

1. Download Sublime Text 2

2. Unzip the downloaded file

tar vxjf Sublime\ Text\ 2.0.2.tar.bz2

3. Move the Sublime Text 2 folder in /opt directory

sudo mv Sublime\ Text\ 2 /opt/

4. Create a symbolic link for sublime so that you can execute it anywhere using the terminal

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Note that /usr/bin must be included in the $PATH variable for the symlink to work.

5. This time, create a desktop file so that sublime can also be executed through a launcher in the Unity.

sudo sublime /usr/share/applications/sublime.desktop

6. Copy the following in sublime.desktop

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
GenericName=Text Editor

Exec=sublime
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

7. To set Sublime as the default text editor, run the command below:

sudo sublime /usr/share/applications/defaults.list

Replace all occurrences of gedit.desktop with sublime.desktop then save.

Now if you right-click a text file, it will show the option "Open With Sublime Text 2"

Comments