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

Use setenv in vim to allow non alphanumeric vars #901

Merged
merged 1 commit into from Apr 14, 2022

Conversation

hazelweakly
Copy link
Contributor

ref: :h setenv() https://vimhelp.org/builtin.txt.html#setenv%28%29

Of note, the :h expr-env documentation says

The functions getenv() and setenv() can also be used and work for
environment variables with non-alphanumeric names.
The function environ() can be used to get a Dict with all environment
variables.

ref: `:h setenv()` https://vimhelp.org/builtin.txt.html#setenv%28%29

Of note, the `:h expr-env` documentation says

> The functions getenv() and setenv() can also be used and work for
> environment variables with non-alphanumeric names.
> The function environ() can be used to get a Dict with all environment
> variables.
@zimbatm
Copy link
Member

zimbatm commented Mar 3, 2022

Nice. Is this backwards-compatible with older versions of vim?

@hazelweakly
Copy link
Contributor Author

It took a bit of digging to find the exact commit, but it appears this is dated back to patch 8.1.1305 (vim/vim@691ddee).

Those appear to correspond to the vims shipped by default in Ubuntu 20.04 LTS (and later), and Debian 11 (having just missed the Debian 10 cutoff). If that's ancient enough, this'll work, if it's not we might need to revisit how we're doing this. Perhaps by exposing a different command that uses setenv and calling the appropriate one in direnv.vim?

@zimbatm zimbatm merged commit 9d9cd5b into direnv:master Apr 14, 2022
@zimbatm
Copy link
Member

zimbatm commented Apr 14, 2022

yeah, that's good enough, thanks

@hazelweakly hazelweakly deleted the patch-1 branch April 19, 2022 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants