Skip to content
Advertisement

Vim use different config or shell enviroment variable when spawning new terminal

Ok, so lets say I spawned a new terminal in vim using :terminal and I want to immediately have a shell enviroment with different/additional enviroment variables within that new terminal window without typing for example VAR=”something”. How do i do that?

Advertisement

Answer

You can set an environment variable in vim and then open a terminal, which will inherit all environment variables from vim.

let $VAR="something"
terminal

In terminal, you can check it by echo $VAR

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement