Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  143] [ 0]  / answers: 1 / hits: 141214  / 3 Years ago, sun, november 14, 2021, 11:30:38

I'd like to replace gedit, and use Sublime Text 3 as my default text editor for all text files on my Ubuntu system. Can you let me know how do I go about making this change?


More From » text-editor

 Answers
5

UPDATE


Sublime Text 4 (builds 4000 and higher) has been released, and is the preferred version of Sublime Text to use. There are instructions on Sublime's website for installation using the package repositories (apt, pacman, yum, dnf, and zypper) for a number of popular Linux distributions. However, even installing in this way doesn't automagically make all text/source files open with Sublime, so you'll likely still need to follow the directions below.


These instructions assume that you have installed Sublime Text either using the .deb file provided for Debian/Ubuntu-based systems, or using the apt repository instructions linked above. If you downloaded the tarball and installed it manually to a location other than /opt/sublime_text, you will need to change the paths below to your install location.




First, make sure that /usr/share/applications/sublime_text.desktop exists (sublime-text.desktop on some systems):


ls /usr/share/applications/sublime_text.desktop

Then, open /usr/share/applications/defaults.list with Sublime:


subl /usr/share/applications/defaults.list

Search for all instances of gedit (org.gnome.gedit on some systems) and replace them with sublime_text. Save the file, log out and back in, and you should be all set.




If for some reason /usr/share/applications/sublime_text.desktop (or sublime-text.desktop) doesn't exist, create it:


sudo touch /usr/share/applications/sublime_text.desktop

Open it in Sublime:


subl /usr/share/applications/sublime_text.desktop

and paste the following into it:


[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;

However, if you installed Sublime Text using the .deb file downloaded from sublimetext.com, the file should already exist.


[#27778] Monday, November 15, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
itteast

Total Points: 291
Total Questions: 123
Total Answers: 104

Location: Tuvalu
Member since Wed, Mar 29, 2023
1 Year ago
;