-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to change session and client environment variables #4482
Comments
krobelus
added a commit
to krobelus/kakoune
that referenced
this issue
Dec 16, 2023
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.
krobelus
added a commit
to krobelus/kakoune
that referenced
this issue
Dec 16, 2023
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.
There is any intention to implement enviroment manipulation command to kakoune? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was wondering if we could change the session and client environment variables once Kakoune has started.
Having a way to access and change them could be nice to
Kakoune already does some path manipulation (#4433) by prefixing the currently running
kak
binary inPATH
, and it could be a good way to expose shell scripts in Kakoune plugins (#4425).The proposal is to add
set-environment [session|client] <name> <value>
,unset-environment [session|client] <name>
%env{name}
expansion.Here is a plugin example with the following files:
rc/connect.kak
bin/:edit
bin/:fzf
In Kakoune, we can now do:
To tune
FZF_DEFAULT_OPTS
in a client:Assuming we have a Kakoune command to spawn a program, it still convenient for interactive usage without writing a wrapper for every windowing system.
Since we have
:edit
and:fzf
inPATH
, we can open a terminal from Kakoune and use the commands in the shell.then in the terminal:
:e docs/*.txt :fzf
The text was updated successfully, but these errors were encountered: