-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed problem with shellslash #371
Conversation
This should fix at least some of the problems caused by having shellslash active on vim.
Please wait before using this. I found a problem on linux distribution: the shellslash option is not disabled, it doesn't exists at all! This will cause an error in this updated code. I'm fixing this by using a pcall, then I'll try updating the PR. Sorry for this |
Tested on my linux laptop, the problem should now be fixed |
Co-authored-by: Ben Weedon <ben@weedon.email>
The problem with doing this is that we use The best example is the function below plenary.nvim/lua/plenary/path.lua Lines 34 to 45 in 1da13ad
now This can not be done "just like that" |
Thank you conni2461 for the reference to this problem. |
I've taken a deeper look at the code, and found that the path separator has been used as a way to check if the os is Windows in the following files:
and in the tests:
I would create a function called This will not affect people who doesn't have shellslash enabled since it won't actually be any different for them, but at the same time it will fix different problems for those who actually use that option. What do you think about this solution? It will cover different files, so I prefer to check with other people before making a commit, even if this is a PR. |
yeah we can do a Actually after reading your code i would argue for dropping the |
Yes, I think it is a good idea. Even if it will be a pretty small file right now :) I've checked on windows with shellslash and indeed I think that extracting that logic into a function will also make it easier in case in the future there will be some changes to be made to check for windows, so it seems like a good idea. |
With shellslash set, using the latest branch, I still get the following error message when attempting to open a file with :Telescope find_files: E5108: Error executing lua ...site/pack/packer/start/plenary.nvim/lua/plenary/path.lua:635: Could not create file: C:\Users\zensh\AppData\Local\nvim\C:/Users/zensh/AppData/Local/nvim-data/telescope_history Fortunately for me, I don't actually need shellslash set, so removing it fixes the issue. For those that do, a simple workaround is to just go to stdpath("data") in a terminal (on windows, something like "C:\Users\user\AppData\Local\nvim-data") and type: touch telescope_history. |
Hi @Conni2461 , @zenshade |
-- The shellslash option is not able to change this variable | ||
if package.config:sub(1,1) == "\\" then | ||
return true | ||
end | ||
|
||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just do return package.config:sub(1,1) == "\\"
we have system checks in telescope too iirc. Could you prepare a pr to replace them with PR mostly looks good to me, thanks :) |
Hi Conni, thank you for the review and the suggestions (don't know why I didn't do that immediatly, tbh). For Telescope, yeah, I will take a look at it once this PR is merged :) |
Hi @andreadev-it, I would be glad if you could integrate my changes into your PR, it almost fixed the problems with The missing idea was to make sure both '\' and '/' is accepted in a path on Windows, independent of |
I've just encountered a problem with my patch and Telescope. If a Windows path has spaces in it, the spaces will be prefixed with '/'; ruining it. Likely spaces in paths get prefixed backslashes somewhere, and it later gets cleaned where the backslashes get replaced with slashes. |
upvote for this PR due to the unresolved "history file creation" issue from telescope. |
bump |
Hi guys, |
This should fix at least some of the problems caused by having shellslash active on vim (#254).
I've tested it as a requirement for neo-tree.nvim, and now it works either with or without shellslash.