Making GVim your Default Text Editor in Gnome

Written by Mark Sanborn: Sep 19, 2007

By default Gnome uses gedit for the defualt text editor. Since I am constantly writing and modifying config files and programming in scripting languages I decided to try the “programmer’s text editor”.

There was a lot of hype about the program so had to find out what the all the hype was. The first time I used Vim I didn’t know what was going on. It seemed like the text editor was going crazy typing characters all over the place or deleting entire lines of code with one key. The learning curve was a bit of a challenge at first but I have since learned to love vim and will be writing more articles about it.

To me Vim is like the Photoshop of text editors. The more you learn it, the more your productivity and abilities increase exponentially. It also increases your geek factor by 10. :) Don’t take my word for it. Try it by installing it and running ‘vimtutor’. Make sure you get through the whole tutorial. It is only the very basics of Vim and you will probably be totally lost without it.

Ok, lets switch the default Gnome text editor to vim…

Install Vim for console and GUI

Type or copy the following command for your operating system.

Debian / Ubuntu sudo apt-get install vim sudo apt-get install vim-gnome

Gentoo emerge -a vim

FreeBSD pkg_add -r -v vim-lite

Tell Gnome You Want to Use GVim

In Gnome Right click on a text file, choose “Open with Other Application…”.

If you are using Ubuntu Gvim will be listed as a program in which to open the text file. Select it and click Open. For other operating systems the default installation for gvim is ‘/usr/bin/gvim’.

Get a terminal, and cd to ~/.local/share/applications. There is now a new file in there called “gvim.desktop” or “gvim-usercreated.desktop”

In that same path create a new file called “defaults.list” with the following info:

[Default Applications] text/plain=gvim.desktop

Restart nautilus with “killall nautilus” (this will make the effect immediate without restarting)

Now, if Gnome gets updated and it changes /etc/gnome/defaults.list, your change would still be in place.

Thats it! You have now changed the Gnome default text editor to GVim. Remember you can still use Vim in the console by using vim instead of gvim.

I hope if you are new to Vim you at least try it for a reasonable length of time. You will probably be slower at first but it will be worth learning. It’s like typing class. Sure, looking at the keys is easier but if you learn to type without looking you will be much faster. :)

If you are an avid Vim user or you are trying it for the first time I would love to hear your experience with it. Leave a comment below.

Need to print shipping labels on your site?

Checkout my product RocketShipIt for simple easy-to-use developer tools for UPS™ FedEx™ USPS™ and more.

Share: