Until now I've been using the alias to xdg-open.
alias o='xdg-open $@ 2> /dev/null'
The default behaviour for xdg-open is to start the process in the foreground of the currently selected terminal so e.g. opening files associated with vim (via xdg-mime) resulted in having the editor being opened in the terminal from which the command was entered.
The issue was that while opening terminal based programs like mutt and vim worked correctly, the e.g. .html files opened in the default browser while my terminal window became unusable because of the process running in the foreground and waiting for the file to be closed.
I have created the function below so that I could open files from the currently used terminal and still be able to work in the same window.
function o(){ xdg-open $@ 2> /dev/null & }
It fixed my problem but now opening e.g. files associated with vim results in showing me the PID and I have to enter $ fg to access the editor.
I tried to edit vim.desktop entry so that it would at least start in a new terminal but I think this is a pretty bad workaround. Could somebody give me a nudge on how to resolve this properly? Thank you in advance.