Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know I could use something like Ubuntu Tweak to change the file associations for each file. But I am wondering if there is a way to do it faster and just set the system so that all the files that would have been opened by gedit are now going to be handled by gvim.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
I did what you said and I finally got gvim to open text files. With my source files however it still uses gedit. How can I really really tell ubuntu to stop using gedit ANYWHERE and use gvim instead? –  Visa is Racism Oct 28 '11 at 13:01
    
What do you mean by source files? –  theTuxRacer Nov 1 '11 at 11:36
    
source files as in .c, .h, .cpp etc! I got my problem solved here –  Visa is Racism Nov 1 '11 at 13:30
    
@Shahbaz sed -n '/=gedit\.desktop$/s/gedit/gvim/p' /usr/share/applications/defaults.list >> ~/.local/share/applications/defaults.list This should make all files that open by default with gedit.desktop to be opened by default by gvim.desktop (for your user). There's probably a "better" way, but I like doing it via the terminal. –  geirha Apr 15 '12 at 20:12
    
@geirha, yeah I asked that question and got a similar answer. I have already put the link in my previous comment. –  Visa is Racism Apr 15 '12 at 20:17
show 1 more comment

This question is asked all the time, and none of the answers seem to work 100%.

If you are lazy and don't mind a quick and dirty hack, try this:

sudo mv /usr/bin/gedit /usr/bin/gedit.old
sudo ln -s /usr/bin/gvim /usr/bin/gedit

Your edit windows will still show "GEDIT" in the title bar, but the window will contain gvim.

share|improve this answer
1  
but beware: as Greg points out, it is a quick but very dirty way. The good thing is.. it works. –  Mahesh Apr 16 '12 at 5:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.