Sublime Forum

Can't make Sublime my default editor in Ubuntu 22

#1

Hello,

I’m almost ashamed to ask this question here because I’ve never failed to make sublime my default text editor. But since a recent fresh install of Ubuntu, something went wrong and my life was torn apart.

What I did, in a nutshell:

  1. Installed sublime text via
    $ url -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add
    $ sudo add-apt-repository “deb https://download.sublimetext.com/ apt/stable/”
    $ sudo apt install sublime-text
  2. Checked that the .desktop file exists:
    $ ls /usr/share/applications/sublime_text.desktop
  3. Replaced all occurrences of gedit by sublime_text in /usr/share/applications/defaults.list

I’ve always used this method and yet when I click a file, I still have the gnome text editor showing up. And no idea how to debug that.

If you have a brilliant idea to help me out, it would fill my heart with joy and wonders, nothing less.
Thanks in advance!

0 Likes

#2

maybe there is something set in ~/.config/mimeapps.list which overrides it?

0 Likes

#3

No unfortunately it doesn’t seem to be that.
The only thing relative to text files I have in there is:
[Added Associations]
text/plain=sublime_text.desktop;

0 Likes

#4

Hmm, maybe try mimeopen?
https://askubuntu.com/a/755168/531664

0 Likes

#5

Thats really funny because when I do:
mimeopen .py
I get this:
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Please choose a default application for files of type text/x-python

    1) Sublime Text  (sublime_text)
    2) LibreOffice Writer  (libreoffice-writer)
    3) Text Editor  (org.gnome.gedit)
    4) Vim  (vim)
    5) Open on connected device via KDE Connect  (org.kde.kdeconnect_open)
    6) Other...
use application #

So I guess the default application is sublime. But if I click a python file, I still get gedit.

0 Likes

#7

By using the following steps you can set Sublime as the default editor-

1). Just right-click on any text file
2). go to “properties”
3). then go to “open with”
4). select sublime-text from the lists of applications
5). the click on “set as default” tab

Now your default browser is sublime-text. You can set any app as your default browser by following above method.

0 Likes