Skip to content

Use setenv in vim to allow non alphanumeric vars#901

Merged
zimbatm merged 1 commit intodirenv:masterfrom
hazelweakly:patch-1
Apr 14, 2022
Merged

Use setenv in vim to allow non alphanumeric vars#901
zimbatm merged 1 commit intodirenv:masterfrom
hazelweakly:patch-1

Conversation

@hazelweakly
Copy link
Copy Markdown
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
Copy Markdown
Member

zimbatm commented Mar 3, 2022

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

@hazelweakly
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants