Gedit is the defaut editor to open text files in Ubuntu Desktop. Some people prefer Gvim, and want to replace gedit. Here’s two ways:

Method 1:

This is the easiest way, but only works for current login user.

Right click on a text file and select ‘Properties’ at bottom. In ‘Open with’ tab choose ‘Gvim’ and click ‘Set as default’ at button.

Now all text files will be opened with Gvim by double-click on them.

Method 2:

This will take effect on all Ubuntu users.

Open up a terminal window and edit the configuration file:

sudo gedit /etc/gnome/defaults.list

find out:


change it into:


close and save it.