Available languages

Useful links
Читать на русском

Saturday, April 14, 2012

Ubuntu Sublime Text 2 as default text editor | Ubuntu Notepad++ Replacement | Bash script can handle filenames with spaces

Short description:
We install "Sublime Text 2" in steps 1 to 4.
We set "Sublime Text 2" as default text editor in step 5.

1. Download Sublime Text 2 from its official site or from my mirror.

2. Extract obtained archive somewhere. Rename the folder you've got to "SublimeText2".

3. Open terminal in the directory where "SublimeText2" folder is located and run the following command: 
sudo mv SublimeText2 /usr/lib/

4. Download sublimetext and sublimetext.desktop from my mirror. Open terminal in the directory where these files are located and run the following commands: chmod +x sublimetext sublimetext.desktop
sudo mv sublimetext /usr/bin/
sudo mv sublimetext.desktop /usr/share/applications/

5. Create an empty file without extension, ie: Open your home directory in nautilus, select menu item File -> Create New Document -> Empty Document, press Enter. Right-click on just created "Untitled Document" -> Properties -> tab "Open with" -> Show other applications -> find "sublimetext" in the list -> Set as default. Close. Now, you may delete "Untitled Document".

That's it.

UPD: You can also just edit ~/.local/share/applications/mimeapps.list to set default applications. See an example of mimeapps.list under the cut.

[Added Associations]

[Default Applications]
You see, I have chosen Sublime Text as my default editor of plain text (text/plain), c++ source (text/x-c++src) and header (text/x-chdr) files.


Muzi said...

thanks, simple and it works very well.

VaiN said...

Doesn't seem to work in linux mint (even when using the CORRECT .desktop name)


Also, you should be installing from stable package: here

Федор Бирюков (Theodore Biryukov/Fedor Biryukov) said...

Thanks, Muzi. Thanks, VaiN. Feedback is appreciated.

VaiN, I suppose it worked fine for me on Mint>=11, Ubuntu 11.*, 12.*.
I've just tested it for you on a recently installed Ubuntu 12.10. It works fine.

What do you mean with "CORRECT .desktop name"? If you want help, you should be able to describe your problem.

Thanks for a stable package, I still prefer getting it from the author's page.