Same question as this, however the solution there didn't work.
I set these variables in my ~/.vimrc:
set shellcmdflag=-ic
set shell=/bin/bash -i
and I have an alias in my ~/.bash_aliases:
rgr() { if [ ! -z "$2" ]; then grep -rI --exclude=*.svn* "$1" * --include=$2 ; else grep -rI --exclude=*svn* "$1" * ; fi ; }
which works when executed from the command line, but when I try to call it from Vim with :!rgr test
, I get an error message and Vim exits:
bash: rgr: command not found
[4]+ Stopped vi ~/somefile
If I disable the interactive mode, I just get the "command not found" message and Vim doesn't exit.
How can I get Vim to recognize my aliases? I've reproduced this behavior on both OS X and Ubuntu.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…