The behaviors of firenvim#install and firenvim#uninstall on WSL are controlled by the script variable s:is_wsl: we initialize it to false to (un)install firenvim on wsl side, and then set it to 1 to (un)install on windows host side.
Currently, only firenvim#install and firenvim#uninstall changes the value of s:is_wsl. The two function do not reset s:is_wsl, and thus s:is_wsl is always 1 after calling them.
As a result, doing the followings sequentially in neovim have unexpected results:
-- 1. `s:is_wsl` is set to 1
vim.fn["firenvim#install"](0)
-- 2. uninstall firenvim only on windows host because `s:is_wsl` is 1
vim.fn["firenvim#uninstall"]()
-- 1. `s:is_wsl` is set to 1
vim.fn["firenvim#uninstall"]()
-- 2. reinstall, installs scripts on host only, no scripts on WSL
vim.fn["firenvim#install"](0)
To fix this, a try ... finally block resets s:is_wsl even if the two functions throw errors or run unsuccessfully.
The behaviors of
firenvim#install
andfirenvim#uninstall
on WSL are controlled by the script variables:is_wsl
: we initialize it to false to (un)install firenvim on wsl side, and then set it to 1 to (un)install on windows host side.Currently, only
firenvim#install
andfirenvim#uninstall
changes the value ofs:is_wsl
. The two function do not resets:is_wsl
, and thuss:is_wsl
is always 1 after calling them.As a result, doing the followings sequentially in neovim have unexpected results:
To fix this, a
try ... finally
block resetss:is_wsl
even if the two functions throw errors or run unsuccessfully.