My project requires to set some env var before running go test. How can configure vim-go to do something like source .env.dev && go test ... upon calling :GoTest in vim?
You can use the $ notation to set environment variables in Vim:
let $MY_ENV_VAR = "my value"
You can chain Vim commands with |:
:let $MY_ENV_VAR = "my value" | :GoTest
Of course, that's some typing so you may want to use a command:
:command! GoTestEnv let $MY_ENV_VAR = "my value" | :GoTest
(note: if you use a mapping then read :help map-bar).
If you want to source a file then you can use the :source command on a file that has a bunch of let $ENV = "value" commands.
Most helpful comment
You can use the
$notation to set environment variables in Vim:You can chain Vim commands with
|:Of course, that's some typing so you may want to use a command:
(note: if you use a mapping then read
:help map-bar).If you want to source a file then you can use the
:sourcecommand on a file that has a bunch oflet $ENV = "value"commands.