arm1.ru

How to install Sublime Text 2 on Ubuntu 12.04 with Unity

Sublime Text 2 runs without installation, but doesn’t integrate with the system at all. You can’t even associate certain file types with it out of the box. How to install Sublime and integrate it with the system:

  1. Unpack the Sublime archive
  2. Move Sublime to /usr/lib:
    sudo mv Sublime\ Text\ 2 /usr/lib/
  3. To launch the editor from the terminal with the «sublime» command:
    sudo ln -s /usr/lib/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
  4. To create a Unity launcher that shows up properly in the dock:
    sudo sublime /usr/share/applications/sublime.desktop
    and paste in the following:
    [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
    Terminal=false
    Icon=/usr/lib/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
  5. If you want to set file associations so that certain file types open in Sublime:
    sudo sublime /usr/share/applications/defaults.list
    and in that file replace every gedit.desktop with sublime.desktop

After this, everything will look as if it’s native.

Original in English.

keyboard_return