Sublime text as default editor for all text files
Solution 1
The solution provided by Anwesha will work but you will have to manually make sublime text your default opening application for all file formats.
What worked for me in 17.10 was using update-alternatives
First what you need is the path to the executable file for sublime text. I have ST 3 and it was at /opt/sublime_text/sublime_text
Then open your terminal and use the following commands:
sudo update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /path/to/executablesublime 100
sudo update-alternatives --config gnome-text-editor
This will bring up a list of the available alternatives, where the default is marked by an asterisk. If sublime text is not it, then select it now by entering corresponding number. Make sure sublime-text's priority is the highest.
And you're done! Hope this helps :D
Solution 2
To make Sublime Text your default text editor, you need to right-click on any text file, select Properties, then the Open With tab. Select Sublime from the list, and click on the Set as default Button.
Related videos on Youtube
Bran Algue
Updated on September 18, 2022Comments
-
Bran Algue over 1 year
I have seen other answers, but after following instructions my default editor is LibreOffice, even for txt files.
I want to have Sublime Text 3 as default editor for all text related files: txt, makefile, cpp, h, md, etc.
My default list is full of sublime-text.desktop, and does not contain any libreoffice-writer.desktop. However, all txt files are opened in LibreOffice Writer. The only extension that is opened in sublime text after double clicking is cpp. I can open sublime-text as usual (and also via subl in command line) and can open files from it, but I want to open text files in Sublime Text by double clicking on them. The version of Sublime Text is 3126. Ubuntu is 16.04.
Here is sublime-text.desktop and here is defaults.list.
How can I set sublime text as default editor and why LibreOffice writer opens text files?
-
mook765 about 7 yearsI don't have a dropbox-account, this might be the reason why I can't see much in your provided links. Other users may have the same problem.
-
Bran Algue about 7 yearsI fixed links so that you can see directly text files. No need for dropbox account to see the files.
-
M. Becerra about 7 yearsCreate an empty
file.txt
, right-click > Properties > Open with > Select Sublime > Set as default - Is any.txt
opened with Sublime now? -
mook765 about 7 yearsConfusion with dash and underscore? In
default.list.txt
the entries point tosublime-text.desktop
in some cases and tosublime_text.desktop
in other cases. -
Bran Algue about 7 yearsAmazing spot @mook765! It was sublime-text.desktop on some entries even though it should've been sublime_text.desktop. Now solved.
-
mook765 about 7 yearsGreat. Would be nice if you put this in an answer then. I will come and upvote.
-
-
hoijui over 6 yearsin addition to this, i also had to edit /usr/share/applications/defaults.list, to remove
text/plain=gedit.desktop
, for thegnome-text-editor
setting to take effect for simple text files. same for other mime types for which you want the default text editor to apply, for exampletext/x-python=gedit.desktop
-
Parth Patel almost 5 yearsPlease add the comment to the answer itself. It would be much more helpful
-
Giorgi Gvimradze almost 5 yearsSeriously? those are Wimdows settings...