Ubuntu – how can I change file association globally?

default-programsfile association

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?

Best Answer

This answer only works in Ubuntu 16.04 or prior; the comments have a link to a Xenial release of Ubuntu-Tweak. In newer versions of Ubuntu this will not work as Ubuntu-Tweak is no longer supported by the author.

Comments have suggested that Chris Marx answer below is the right way, but it does not resolve the answer of administrative management - for example, setting the type for many items.

Note: Ubuntu 16.04 is still LTS and Ubuntu 14.04 is not EOL

The EASIEST way for you to do this would be to install the program Ubuntu Tweak.

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