I am trying make a filetype dependent gvim alias in bashrc as:
if [[ $file == *.tex ]]; then
alias vi="/home/rudra/bin/vims.py"
else
alias vi="gvim"
fi
And I am expecting to run ~/bin/vims.py foo.tex for vi foo.tex file, and gvim bar.txt when I type vi bar.txt. But, its not working, and only running gvim foo.{tex/txt} for all extensions.
It is also showing:
which vi
alias vi='gvim'
/usr/bin/gvim
So I guess, if condition for *.tex is not working at all. Any idea why?
I am using:
bash --version
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
\vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 26 2017 07:53:42)
also:
vi --version
bash: syntax error near unexpected token `--version'
zshthere issuffixaliasalias -s tex=$editor, seen here. Switch to zsh however is for another day and not always recommended.