zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Environment variables are not recognised in config files

Open MurtadhaInit opened this issue 1 year ago • 3 comments

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.

MurtadhaInit avatar Jun 22 '23 23:06 MurtadhaInit

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

jaeheonji avatar Jun 24 '23 17:06 jaeheonji

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

MurtadhaInit avatar Jun 29 '23 15:06 MurtadhaInit

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!

steakhutzeee avatar May 03 '24 23:05 steakhutzeee