I have a number of aliased commands in my .bashrc and they work fine on the command line. However, if I use them in Vim, they do not work. For example:


results in:

/binbash: mycommand: command not found

What is the explanation?

  • I suspect that it has something to do that vim invokes shells (e.g. requested by ! or system()) as non-interactive and non-login shell, which means .bashrc or .zshrc are not read. You could try making it interactive by setting 'shellcmdflag' to "-ic".
    – Hotschke
    Nov 17, 2018 at 14:16
  • 2
    @Hotschke There’s a better solution here: vi.stackexchange.com/a/11173/343
    – Rich
    Nov 17, 2018 at 15:41
  • @Rich yes, that really is better.
    – Hotschke
    Nov 17, 2018 at 15:42


Browse other questions tagged or ask your own question.