Quantcast
Channel: Have utilities like vim and less source .bash_login or .bashrc for command lines - Super User
Viewing all articles
Browse latest Browse all 2

Answer by filbranden for Have utilities like vim and less source .bash_login or .bashrc for command lines

$
0
0

At least for Vim, you can use the following in your .vimrc:

set shellcmdflag=-ic

There's a call out for that in :help :!cmd:

On Unix the command normally runs in a non-interactive shell. If you want an interactive shell to be used (to use aliases) set 'shellcmdflag' to -ic.

Not sure whether you can do the same in less...

But note that generally it's not a great idea to call aliases from shelling out of these tools, since aliases are mostly meant for interactive use of the shell, or for commands that change the state of the current shell (change directory, export new variables, etc.) For all else, using external commands (which can be implemented using shell scripts) are usually a better choice.

So maybe consider doing that instead, replacing aliases with shell scripts in a directory you add to $PATH, which will be naturally available to all your tools which are able to shell out.


Viewing all articles
Browse latest Browse all 2

Trending Articles