Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reset s:is_wsl after calling (un)install
The behaviors of `firenvim#install` and `firenvim#uninstall` on WSL is 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: ```lua -- 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"]() ``` ```lua -- 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.
- Loading branch information