How to set default editor in 13.04?
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.
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.
Related videos on Youtube
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, 2022Comments
-
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 possiblyemacsclient
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 over 10 yearsTo 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 over 10 yearsnope still the same
-
Bleeding Fingers over 10 yearsI 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 over 10 years
-
Alvar over 10 yearsSo you don't want a solution that works instead you want to find a harder way to do it? -_-
-
Bleeding Fingers over 10 yearsif 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 over 10 yearsPlease let me know if this answered it, or if you still need help with your question. Thanks!
-
Bleeding Fingers over 10 yearsone drawback I see with this approach is that it'll changes the settings for all other users
-
Nullet over 10 yearsSee the updated answer..
-
faizal almost 10 yearsIt should be
/usr/share/applications/defaults.list
.defaults
is missing thes
. -
faizal almost 10 yearsalthough this does not resolve the OP, it does resolve my issue of changing the default editor used by a
git commit
command. -
Akronix over 9 yearsuse select-editor I think it does the same but doesn't need sudo privileges
-
insign about 8 yearsTo me worked:
xdg-mime default org.gnome.gedit.desktop text/plain
-
HDave almost 8 yearsDoesn't work in 16.04 anyway...as with so many Ubuntu niceities, they are short lived...