danielfalk / smart-open.nvim

Neovim plugin for fast file-finding
MIT License
498 stars 25 forks source link

Crash related to Windows directory separtor #32

Closed SamWindell closed 1 year ago

SamWindell commented 1 year ago

Thanks for making this, I'm finding it very useful.

On Windows I am getting a crash: attempting to perform arithmetic on a nil value "last"

Here is the code causing the issue. https://github.com/danielfalk/smart-open.nvim/blob/ecaf1f272328d62fffd115b1a42ec6aacb48e676/lua/smart-open/util/virtual_name.lua#L16-L26

The variable last is still nil at the end of the function because on Windows, the path separator is \ instead of /. If I changed "/" into "\\" the error is fixed.

So I believe that all we need to do is change the directory separator depending on if Windows or not.

danielfalk commented 1 year ago

I don't use windows, and so can't test it there. I can add a note to the readme that says that it's not officially supported. I can take PRs though.

SamWindell commented 1 year ago

Ah ok, I'll have a go at making a PR for this in the next couple of days.

This is the only issue I've had on Windows.