Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While trying to make vim default instead of gedit, I found this could be done two ways:

  1. Use defaults.list and make text/plain (and others) point to vim.desktop (what is the format for creating .desktop files?)

  2. Use update-alternatives and change gnome-text-editor (right now it has only one alternative, so I guess I have to install one more. How to do that?)

Which is the better way to do it?

share|improve this question
how do you want to launch (g)vim? command line? clicking a icon? – akira Apr 8 '11 at 6:46
@akira: If I click a text file, vim should open in a terminal. – N 1.1 Apr 8 '11 at 6:50
any objections against gvim? – akira Apr 8 '11 at 6:52
@akira 1. I don't have it installed, 2. Why not vim? – N 1.1 Apr 8 '11 at 6:56
@N 1.1: coz you have to associate something like 'xterm -e vim ' with the extension you want to use. vim is a terminal application (it has no 'window'). – akira Apr 8 '11 at 7:00

There is a command


That is for the user. Globally You can use update-alternatives to set editor to vim

share|improve this answer
If your editor isn't on the list, do this first (for geany) update-alternatives --install /usr/bin/editor editor /usr/bin/geany 10 – PJ Brunet Feb 6 '15 at 5:24

Ok, I have created vim.desktop in ~/.local/share/applications and modified defaults.list (in the same dir) to include


After that, sudo update-mime and its working! (I am not sure whether this step is require)

Clicking on a text file opens vim, not gvim, in terminal and :q closes the terminal too.

p.s. there are many *.desktop in the mentioned folder, copy the necessary key=values from them and create vim.desktop

share|improve this answer

When you install the vim packages one of those change the default editor for you. I think it's the gvim package that fixes your problem.

aptitude install vim vim-scripts vim-doc vim-gui-common vim-gnome

And the most common way to use vim is that if you start it from X you start gvim, and if you are in a terminal you start vim.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.