Opensuse 13.2 - Sublime as standard editor

Asked

Viewed 316 times

6

I downloaded the sublimeText2 for text editing and would like to define it as the default editor instead of the gedit but I’m not getting it.

Attempts

  1. Arquivo -> abrir com -> outro aplicativo -> visualizar todas as aplicações
    however it does not appear in the listing, I believe it is because it is downloaded and executed, not installed.

  2. Terminal -> su -> usr/share/applications/

    • archive sublime.desktop
    • vim defaults.list replace all gedit for sublime
  3. Terminal -> su -> usr/share/applications/

    • archive sublime.desktop
    • vim mimeinfo.cache replace all gedit for sublime

Sublime content.desktop

[ktop Entry]
Name=Sublime
Comment=Sublime text Editor
Exec=sublime_text %U
Icon=sublime-dark-icon.gif
Terminal=false
Type=Application
Encoding=UTF-8
Categories=text/editor;
MimeType=text/plain;

Question

Would anyone know what I’m doing wrong? and how to solve?

  • you have to necessarily use the portable version?

  • @Caiofelipe actually I just entered the site and downloaded this link c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2%20x64.tar.bz2

  • I had a similar problem with windows, and it was the portable version’s fault. this answer helped me http://stackoverflow.com/questions/9450895/sublime-as-default-editor but it’s windows, right... I don’t know if it helps you much

  • @Caiofelipepereira was worth the try, but no help, linux is quite different.

  • I put a reward/ see if anyone else is interested in helping

  • da p/ do a gambiarra, rename the gedit la no /usr/bin and place the sublime with the same name(renamed) there

  • Thank you, @Sneepsninja, are even thinking of for a reward.

  • I was researching to create or define the sublime as application, however the only references I found commented on the main menu that I already have, but does not appear in the applications.

  • 1

    @Sneepsninja I went back to testing with the .desktop and managed to resolve was missing the X-KDE-Protocols=Sublime in the file, this way appears in the Open with properties. If you want to post a reply with this solution, I will mark as solved for you to resume your points.

  • post yourself the solution, can mark your own answer as accept without problems

Show 5 more comments

3 answers

4


As I told in the comments with @Sneepsninja, I found the solution performing some tests on .desktop in usr/share/applications/.

I noticed that the only difference between the files :

skype desktop.

[Desktop Entry]
Name=Skype
Comment=Skype Internet Telephony
Exec=skype %U
Icon=skype.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
MimeType=x-scheme-handler/skype;
X-KDE-Protocols=skype

Sublime.desktop

[Desktop Entry]
Name=Sublime
Comment=Sublime text Editor
Exec=sublime_text %U
Icon=sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=text/editor;
MimeType=text/plain;
X-KDE-Protocols=sublime

Was the lack in the X-KDE-Protocols, whereas the Skype appeared in the Open with and the sublime no.

This way after editing the file by adding the X-KDE-Protocols, he started to appear in Open with. Then just set it as a pattern.

Update 27/02/2017

Process

  • 1º - Download sublime_text and extract its contents.
    Let’s say to /home/user/bin/sublime_text
  • 2º - In the terminal access the folder of sublime and permission +x (execution) for sublime_text.
    chmod +x /home/user/bin/sublime_text/sublime_text
  • 3º - Create a symbolic link to /usr/bin (Note that this will affect all users, and you must have permission).
    ln -s /home/user/bin/sublime_text/sublime_text /usr/bin/sublime_text
  • 4º - Copy the Icone from the sublime to /usr/share/pixmaps/.
    cp /home/user/bin/sublime_text/Icon/128x128/sublime-text.png /usr/share/pixmaps/sublime-text.png
  • 5th - Create a .desktop in /usr/share/applications/ (As commented above).
    NOTE: This only serves to create an icon in the menu.
  • sixth - alt+r and execute command r, if it doesn’t work maybe I’ll have to reboot.

1

file.(txt|js|php..) > Properties > Open With > Sublime text 2 > Set as default

0

makes a reconfigure like this

update-alternatives --config editor

or put it in your hand in your rc.local file like this

export EDITOR=<caminho do seu editor ex:/usr/bin/pico>
  • in the update-alternatives --config editor the sublime also does not appear in the list of --config. As to the export , created like this export Sublime=Programas/SublimeText2/sublime_text and gave ok, but how to implement it now?

  • @Guilhermelautert in rc.local you put the line "export EDITOR=/usr/bin/sublime" without the quotes. You may have to exchange the word sublime for another try to autocomplete with TAB in the shell to see how it appears that way it appears in the shell that has to be in the export path

  • @Guilhermelautert managed to settle the matter ?

  • Not yet, in the end I always open by dragging the file, and left so, but thanks.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.