Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Option to override environment variables in child processes
Today I have to restart Kakoune in order to set environment variables in shell expansions globally. For example KAK_LSP_FORCE_PROJECT_ROOT. When running ":git" commands, there is an ambiguity on whether to use the $PWD or the buffer's worktree. We use $PWD but it should be possible to override this behavior. An obvious way to do this is to override Git environment variables: set-option -add global env GIT_WORK_TREE=/path/to/my/repo GIT_DIR=/path/to/my/repo.git (another in-flight patch adds the obvious default to GIT_DIR so we don't need to set that). --- There are some minor issues left - If a user sets PATH, this will stomp the one we setenv()'d. - Today both key and value require escaping for = and \. This is not intuitive. Since neither environment variables nor ui_options ever need a = in the key name, we can get rid of the escaping. Alternative approach: The str-to-str-map can be somewhat clunky. We could instead export any option named like env_FOO. Not yet sure which approach is better. Closes mawww#4482 That issues asks for a separate client-specific env as well but we don't have a client scope so I'm not sure.
- Loading branch information