Making GVim your Default Text Editor in Gnome
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.







[...] to a smaller number (faster) or a larger number (slower). You can do this with your favorite text editor or Nano text editor if you don’t have a favorite [...]
[...] If you are not familiar with the awesomeness of VI(m) check out this post, Making GVim your Default Text Editor in Gnome. [...]
[...] Making GVim your Default Text Editor in Gnome [...]
[...] I want to optimize code, automate, and increase my productivity as a user. Just as there are more efficient text editors and operating systems, we also have more efficient email programs. Mutt is one of them. Since Gmail [...]
I began with ‘vi’ on SCO Unix since 1991 and while it was a bear to learn, it became the only editor that I will use. Think I started using gvim since the very early versions when I was working with MS Windows. Everywhere I go, that is what I install first.
Some shops have tried to push to use Eclipse but frankly I think I’m faster with gvim and just an API doc for whatever language.
@Eli,
Yea its been now about 9 months since REALLY using Vim and I now use it for everything. I can’t imagine why anyone would use Eclipse, dreamweaver, notepad, or any other editor. It truely is that amazing.
Although I am new and only know a handful of modes/commands I am already far more productive. It is going to be crazy to think of how much more productive I will be after I learn the rest.
Mark
Hi
I am getting error when I am using
sudo apt-get install vim
sudo apt-get install vim-gnome
in ubuntu.
package vim-gnome is not available. but is to be refered by another package. This means that the package might be missing.
can you help me in this.
Thx
Sivaswami,
Try doing
sudo apt-cache search vim
This will list all packages that have anything to do with vim. They may have changed the name of it since I wrote this article. Unfortunately I don’t have an active Ubuntu install right now to tell you the exact package name.
I just did a search and the package still should be called vim-gnome.
http://packages.ubuntu.com/hardy/vim-gnome
Make sure your repos are up to date.
to edit all editable files add to defaults.lst
[Default Applications]
application/x-perl=gvim.desktop
text/plain=gvim.desktop
text/x-chdr=gvim.desktop
text/x-csrc=gvim.desktop
text/x-dtd=gvim.desktop
text/x-java=gvim.desktop
text/mathml=gvim.desktop
text/x-python=gvim.desktop
text/x-sql=gvim.desktop