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?
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:
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:
speaking about how things works globally, for the entire system, the most important thing is
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
like so
text files, python scripts, web pages, usually any given file has its own mime type.
Add the following lines to ~/.local/share/applications/defaults.list
Now every file on your machine will open with gvim, by default.
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.
Go to Details from Unity Dash, click on Default Applications on the left pane. Change the file associations as per your preference. No additional installation required and you can set all your default applications from one place.