In Vim, when I run this command :!bash -c "ll"
, I get this error message bash: ll: command not found
. ll
is an alias in my ~/.bashrc file. If I just enter ll
from bash it works. I created a ~/.bash_profile file and added the following to it:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
I looked at my ~/.profile file and saw that it already had this at the beginning:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
I even tried setting bash to run in interactive mode, and it still won't recognize my aliases. If I use ls
instead of ll
, it works fine, since ls
is not a custom alias.
-i
to theshellcmdflag
setting, e.g.:set shellcmdflag=-ic
. This makes sure the spawned shell is an interactive shell which reads your aliases.