I like my vi command to open the file in Gvim and to open it in a new tab if Gvim is already running.
function vi { if [[ -z $@ ]]; then gvim elif [[ ${1:0:1} = - ]]; then gvim "$@" else gvim --remote-tab-silent "$@" fi}
This works, but when I specify a filename and it opens in an existing Gvim instance, it doesn't bring the window to the front like it does on Mac or Windows.
How can I make it so that when I enter a "vi file.txt" command in the terminal, it will make Gvim the active window?