-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Showing
1 changed file
with
50 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters