How do I set gvim as my default text editor instead of gedit?

Right click the file you want to open, select "Open With other application". A Window will pop-up containing a list of all the installed programs. Select gvim from the list, and make sure "Remember this application..." is selected. That will open all files of that type in gvim. However, that is only half the story, since there are many more file types. Another way is to edit or create this file:

~/.local/share/applications/defaults.list

and make sure it contains

[Default Applications]
text/plain=gvim.desktop

A recommnded way of doing it is to type this command in a terminal:

sudo update-alternatives --config editor

to update the command line editor, and

sudo update-alternatives --config gnome-text-editor

to update the GUI editor. Enter the number corresponding to the editor that you want to set as you editor, and press enter. That will update all you system references.

That should about do it.


Just take any file which opens with gedit by default, goto it's properties and change the default app it opens with to gvim. And done!