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:
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.
This will take effect on all Ubuntu users.
Open up a terminal window and edit the configuration file:
sudo gedit /etc/gnome/defaults.list
change it into:
close and save it.