Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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:

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

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?)

and which is the better way to do it?

share|improve this question

OP fixed the problem here:

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.

share|improve this answer

For a graphical environment I use something like this:

Open Nautilus-RightClick on desired File-Properties-Open with...-Select

Then point to a simple wrapper, e.g.

gnome-terminal.wrapper -e vim $*

It's not a global solution, though.

share|improve this answer
@N 1.1: Would be nice to leave a comment to explain the reason for downvoting. Or better comment before downvoting to give a chance to improve the answer. Maybe I misunderstood your question, but it works for me. – Clausi Apr 8 '11 at 8:06
I agree with you but in fairness the -1 could have come from anybody with enough reputation. Not neccessarily N 1.1 – Oli Apr 11 '11 at 13:22

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.