How to set default editor in 13.04?

24,156

Solution 1

This is how you set default applications..

Point and click:

Right click on the text file you want to open, choose Properties and then Open with. You should find Emacs in the Recommanded Software list. Click the Set as default button.

Using the commandline:

If you want to set default applications using the terminal, you use to XDG tool.

xdg-mime default emacs23.desktop text/plain

Then try to open a plain text document.

If you want to set default applications for the current user, edit this file:

~/.local/share/applications/mimeapps.list

To edit global settings by hand, see this file:

/usr/share/applications/default.list

Edit: Thanks to Oli how made me aware of XDG in the comments below the question

Solution 2

Try this. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo update-alternatives --config editor 

When it comes up choose your editor. See image below.

enter image description here

Solution 3

I have already asked a similar question about changing all the associations for Gedit to Sublime Text (another GUI editor).

That's essentially where you answer lies except instead of using a .desktop file for Sublime Text, you'll be adding one (if one doesn't exist) for Emacs and then just changing all the associations to that.

Share:
24,156

Related videos on Youtube

Bleeding Fingers
Author by

Bleeding Fingers

SSBsb3ZlIHByb2JsZW0tc29sdmluZywgcHJvZ3JhbW1pbmcsIGFuZCByZWFkaW5nIGFuZCBsZWFy\nbmluZyBhbG1vc3QgYW55dGhpbmcgcmVsYXRlZCB0byB0aGUgZmllbGQgb2YgY29tcHV0ZXJzIGlu\nIG15IHNwYXJlIHRpbWUuIEJSQiB3aXRoIG1vcmUu\n I am nerdier than 87% of all people. Are you a nerd? Click here to take the Nerd Test, get geeky images and jokes, and write on the nerd forum! http://www.nerdtests.com/images/ft/nq/9ffc03eb9d.gif

Updated on September 18, 2022

Comments

  • Bleeding Fingers
    Bleeding Fingers over 1 year

    None of this, this nor this worked in setting my default editor. Haven't tried this, I'm afraid it won't work either.

    So how do I set the default editor to emacs or possibly emacsclient in 13.04 through the CLI/terminal?

    Double-clicking on a text file still opens up to gedit.

    I specifically say 13.04 because I had no problem in doing so in 11.04 from which I recently upgraded from.

    • Oli
      Oli over 10 years
      To clarify, you want to set your GUI editor to a CLI editor? I think a few people are getting hung up on the CLI element but it's actually the XDG default that you're trying to alter, not $EDITOR.
  • Bleeding Fingers
    Bleeding Fingers over 10 years
    nope still the same
  • Bleeding Fingers
    Bleeding Fingers over 10 years
    I had the option of doing that, but I prefer doing it through the CLI because that way I get much more insight on what goes around behind the scene.
  • Bleeding Fingers
    Bleeding Fingers over 10 years
  • Alvar
    Alvar over 10 years
    So you don't want a solution that works instead you want to find a harder way to do it? -_-
  • Bleeding Fingers
    Bleeding Fingers over 10 years
    if the answers out there work for me/13.04. I'll then have to ask you/moderator to mark this question "duplicate". Or I will flag it.
  • Nullet
    Nullet over 10 years
    Please let me know if this answered it, or if you still need help with your question. Thanks!
  • Bleeding Fingers
    Bleeding Fingers over 10 years
    one drawback I see with this approach is that it'll changes the settings for all other users
  • Nullet
    Nullet over 10 years
    See the updated answer..
  • faizal
    faizal almost 10 years
    It should be /usr/share/applications/defaults.list. defaults is missing the s.
  • faizal
    faizal almost 10 years
    although this does not resolve the OP, it does resolve my issue of changing the default editor used by a git commit command.
  • Akronix
    Akronix over 9 years
    use select-editor I think it does the same but doesn't need sudo privileges
  • insign
    insign about 8 years
    To me worked: xdg-mime default org.gnome.gedit.desktop text/plain
  • HDave
    HDave almost 8 years
    Doesn't work in 16.04 anyway...as with so many Ubuntu niceities, they are short lived...