Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

Inconsistent evaluation of snippets directory #485

Closed harshad1 closed 4 years ago

harshad1 commented 4 years ago

I have g:neosnippet#snippets_directory = "$XDG_CONFIG_HOME/nvim/snippets"

on linux I have XDG_CONFIG_HOME = /home/<username>/.config on windows I have XDG_CONFIG_HOME = "C:/Users/<username>/.config

On linux this evaluates to the correct location. On windows, however, when I execute :NeoSnippetEdit neovim opens C:/path/to/current/directory/$XDG_CONFIG_HOME/nvim/snippets. I think the problem is that $XDG_CONFIG_HOME isn't expanded properly and so is evaluated as a relative path.

For reference, I use powershell and XDG_CONFIG_HOME is exported like so: Set-Variable -Name "XDG_CONFIG_HOME" -Value "C:/Users/<username>/.config"

harshad1 commented 4 years ago

This isn't a neosnippet bug. Neovim will only read environment variables from control panel -> environment variables. Setting XDG_CONFIG_HOME there and using

g:neosnippet#snippets_directory = $XDG_CONFIG_HOME . "/nvim/snippets"

as per https://vi.stackexchange.com/a/16072 fixes the issue.

Apologies for the noise.

Shougo commented 4 years ago

Yes. This is Vim/neovim's feature.