2

I have g++ alias defined in my .bashrc file as

alias g++='g++ -Wall -DLOCAL=1'

I am invoking following command from vim command/normal mode to compile a program -

!g++ %

The issue is, this command is working, but this is not picking the alias that's defined in bashrc file. It appears vim is invoking the original g++. To be precise, it looks like vim is not executing the command in current shell/env setup.

When I run g++ file.cpp from bash commandline the alias is being picked up correctly.

Ofcourse I can dump the entire required command in the command mode, but I would like vim to pickup the alias defined in .bashrc file.

Any way to achieve this?

  • 1
    You might be interested in :make and 'makeprg' – D. Ben Knoble Apr 21 at 13:49

Browse other questions tagged or ask your own question.