I use nautilus as file manager and would like to use Vim instead of Gedit to edit my text files. Many files (log files, empty files, ) are already opened with Vim, however not all of them, e.g. tex files and XML files are still opened with Gedit.update-alternatives  --get-selections | grep edit yieldseditor                auto     /usr/bin/vim.gnomegnome-text-editor     manual   /usr/bin/vim.gnomereadline-editor       auto     /usr/bin/rlwrapand I have also set the VISUAL and EDITOR environment variables to point to vim.Although the questions is about changing the default applicatin for any file type, it is fine to respond with a solution that just addresses the mentioned problem changing the default editor, since that is what bothers me at the moment.EDIT:  The answer of hesse worked for most file types, but not for all. For instance Makefiles are still opened with Gedit. file --mime-type Makefile returns text/plain, which is already included in ~/.local/share/applications/defaults.list. However file --mime-type somefile also returns text/plain but is opened with Vim.I use Debian unstable.
Set default application for particular file types in nautilus
nautilus;defaults
You should take a look in ~/.local/share/applications/defaults.list under [Default Applications]. There you should set the text/plain to point to the .desktop entry for vim, which is usually located in /usr/share/applications/. E.g:text/plain=gvim.desktop