Pradeep CE

Passionate programmer, web developer, motorcycle enthusiast, book lover, aspiring writer and wanna-be entrepreneur :)

Sublime Text on Fedora 22

July 18, 2015

Here’s how I installed and configured Sublime Text 2 on Fedora 22, 64-bit. This should also work for other fairly recent versions of Fedora.

Getting Sublime Text

For Linux, Sublime Text is available as a tarball which contains a pre-compiled executable. So all you have to do is download, extract and run it. You can download it directly from your web browser, or use the following command to download it from the terminal. Don’t forget to escape the spaces in the file-name with a \ (backslash). Note that if your operating system is 32-bit, you should get the appropriate file.

$ wget\ Text\ 2.0.2\ x64.tar.bz2

Extract it using your favorite archiving program. Or you can use tar.

$ tar -vxjf Sublime\ Text\ 2.0.2\ x64.tar.bz2

You may also want to move it to another location, and/or rename it.

$ mv Sublime\ Text\ 2 ~/my/desired/path/Sublime_Text_2

You can now use Sublime Text to create/edit files.

$ ~/my/desired/path/Sublime_Text_2/sublime_text

If you don’t want to type the entire path every time (and I doubt that you do 😛 ), you can either add ~/my/desired/path/Sublime_Text_2/ to the PATH, or symlink the executable to /usr/bin/ (I don’t know if this is a good idea) by typing

$ ln -s ~/my/desired/path/Sublime_Text_2/sublime_text /usr/bin/sublime

Now you can run Sublime Text by opening a terminal and typing

$ sublime my-file-name.txt

Adding it to the Applications list

If you run Sublime Text now, you will probably notice that it has no application icon, and that it’s not present in the Applications list.

To solve this, you have to add a desktop entry for Sublime Text in /usr/share/applications/. To do this, open Sublime Text (or any other text editor) and type (yes, copy-paste) the following:

[Desktop Entry]
Name=Sublime Text
GenericName=Text Editor
X-GNOME-FullName=Sublime Text 2
Comment=Open, view and edit a wide variety of text files

The options are pretty self-explanatory. A couple of important points here, though:

  • The Exec key should contain the command executed when you click on the application icon. If you added the Sublime Text folder to the PATH, this will be sublime_text. If you symlinked it, for example to /usr/bin/sublime, then use sublime.
  • The Icon directory inside the Sublime Text directory contains icons of various sizes. Choose one that looks neat on your screen. The Icon key contains the path to the image you want to use as the icon.

Save this file as sublime.desktop in /usr/share/applications/. Now you will be able to find it in the Applications list. The icon is also displayed.

The Applications list

Making life easier

Now that we are set, we are going to make a couple of adjustments to make life easier. On the menu bar, click on Preferences > Settings — Default. This opens a file named Preferences.sublime-settings which contains various options that can be configured by the user.

First off, tell Sublime Text to convert tabs to spaces. Search for (Ctrl + F) translate_tabs_to_spaces and set it to true.

// Set to true to insert spaces when tab is pressed
 "translate_tabs_to_spaces": true,

If you don’t want auto-complete to enter the suggestion when you hit Enter, then search for auto_complete_commit_on_tab and set it to true. Now you can press Tab to enter auto-complete suggestions, and Enter to enter a newline.

// By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
"auto_complete_commit_on_tab": true,

If you found this useful, or spotted an error, please let me know in the comments 🙂 In a future post, we will see how to set certain file-types (like .php or .py) to open with Sublime Text by default.

This post used to be a part of my old blog, and was migrated here for legacy reasons.

The views and opinions expressed on this site are my own. They do not reflect the views or policies of any employer or client, past or present.

🐞 Found a bug? Slow to load? Hard to navigate? Doesn't look quite right? This blog is still brand-new, so please let me know! 🙏
Pradeep CE | Copyright © 2020 | | v2.0