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.

gedit is set by default to open about any source file. I've gone through the file properties and changed default application to VIM for C and C++ files.

I'd need to do this for any source file I open now, for python files, for text files, for ruby, any, since gedit is set to open all of them.

How can I change this to open with VIM without going the hassle of setting "open with" one by one?

share|improve this question
add comment

5 Answers

up vote 4 down vote accepted

The EASIEST way for you to do this would be to install the program Ubuntu Tweak, this can be downloaded from here: Ubuntu Tweak Download Instructions

Once you have it downloaded you simply open it up, change to Admins tab and then under System choose File Type Manager. Once in here select the file category Text and using shift-click and/or control-click select all of the file types you want, then click Edit on the bottom right.

This will allow you to multi-set the mimetype opener for all of the files.

See screen:

http://i.stack.imgur.com/BZtGN.jpg

share|improve this answer
    
As I was looking for usability, thanks for this one. Very nice tool. –  pepper_chico May 2 '13 at 2:55
    
is Ubuntu tweak supported for 13.10? I can't install it. askubuntu.com/questions/413052/… help plz –  Mina Michael Jan 30 at 17:22
    
@MinaMichael well I use it without problems on 13.10 –  pepper_chico Mar 3 at 4:48
    
@pepper_chico I was having trouble with it; some tabs didn't show anything when I opened them. I uninstalled it and went to the software centre to reinstall it but couldn't find it –  Mina Michael Mar 4 at 10:52
    
@MinaMichael try synaptic, most of times I prefer it. You may also have to use a PPA, don't recall now if I used one. –  pepper_chico Mar 13 at 19:37
show 3 more comments

Seems like the answer here

is actually the easiest, specifically going to a file's properties, going to the "open with" tab, and then setting as default for that file type. Here's the picture:

enter image description here

share|improve this answer
    
Again, just as I have commented already in o'rety's answer: "this is not as easy when you want to set multiple file types at once or by mime type" and this question is about this. The chosen answer is still the right one. –  pepper_chico Mar 13 at 16:11
    
ah my mistake, I was reading that as "setting multiple file's types", not setting multiple default file type associations at once. my mistake- –  chrismarx Mar 13 at 17:58
add comment

I guess the easiest graphical way would be:

Files (nautilus) >> select a file >> right click & Properties >> "Open With" tab >> select a program you fancy >> "Select as default". Done.

This method comes from this post on HowToGeek: http://www.howtogeek.com/117709/how-to-change-your-default-applications-on-ubuntu-4-ways/ where they also talk about how to change default Terminal programs.

share|improve this answer
    
this is not as easy when you want to set multiple file types at once or by mime type –  pepper_chico Jan 14 at 1:05
add comment
touch ~/.local/share/applications/defaults.list

Add the following lines to ~/.local/share/applications/defaults.list

[Default Applications]
text/plain=gvim.desktop

Now every file on your machine will open with gvim, by default.

share|improve this answer
    
What if I wanted to open console vim in Xterm instead? –  Adrian Keister Jun 16 '13 at 19:29
add comment

speaking about how things works globally, for the entire system, the most important thing is

/usr/share/gnome/applications/defaults.list

which is the file that holds the associations between a given mime type and the application that is supposed to handle that kind of file.

If you don't know the mime type of a file simply use the command

mimetype

like so

mimetype img.jpg 
img.jpg: image/jpeg

text files, python scripts, web pages, usually any given file has its own mime type.

share|improve this answer
    
Please update the path(s) in your answer. I'm saying this because I see /usr/share/applications/defaults.list as a link to /etc/gnome/defaults.list in Lubuntu 13.10. –  user25656 Jan 21 at 11:50
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.