Skip to content
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

Environment variables are not recognised in config files #2574

Open
MurtadhaInit opened this issue Jun 22, 2023 · 3 comments
Open

Environment variables are not recognised in config files #2574

MurtadhaInit opened this issue Jun 22, 2023 · 3 comments

Comments

@MurtadhaInit
Copy link

MurtadhaInit commented Jun 22, 2023

Basic information

zellij --version: zellij 0.37.1
stty size: 24 150
uname -av or ver(Windows): Darwin macbookpro.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64

List of programs you interact with as, PROGRAM --version: wezterm 20230408-112425-69ae8472

Further information
In short, having envrionment variables as values for configuration settings in config.kdl is problematic.
E.g. having this line:
default_shell $SHELL
Results in the following error message when opening zellij:
image

And using quotes around it like so:
default_shell "$SHELL"
Results in zellij running but with the prompt hanging like this:
image
You can't do much here except quit zellij.

Those issues don't occur when I set an absolute path like so:
default_shell "/opt/homebrew/bin/zsh"

The same thing happens for other options. For instance:
scrollback_editor "/opt/homebrew/bin/nvim"
This works. But this:
scrollback_editor $EDITOR
does not work. Even though the value of that env variable is set in zsh rc files to command -v nvim

This seems inconsistent with the documentation that mentions the default values for those options are as I typed above.
If I'm missing something or some notation that I should have used, please let me know.

@jaeheonji
Copy link
Member

Hi, @MurtadhaInit

By default, zellij's config file does not support environments. (such as $SHELL, $EDITOR)

// Choose the path to the default shell that zellij will use for opening new panes
// Default: $SHELL
//
// default_shell "fish"

A comment in the config file means that if you don't set a specific shell, it will act as the default shell. That doesn't mean it supports $SHELL env.

And the PR of #2291 only contains the code to support env for layout files. Therefore, in order to apply this feature to the config file, we need to update the zellij-utils/src/kdl/mod.rs

@MurtadhaInit
Copy link
Author

Thanks for the clarification @jaeheonji 🙂
I didn't know that was the case.

@steakhutzeee
Copy link

Hi, this change would have a great impact. Particularly for those who version control their dotfiles. Any chance there is an update about it?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants