plenary.nvim icon indicating copy to clipboard operation
plenary.nvim copied to clipboard

Windows paths fail if 'shellslash' is set

Open sakhnik opened this issue 4 years ago • 1 comments

When I define 'shellslash', Windows paths look like C:/Users/user/.... This results in multiple failures starting from incorrect path.sep detected, leading to errors like:

E5108: Error executing lua ...a/site/pack/paqs/start/plenary.nvim/lua/plenary/path.lua:490: Could not create file: C:\Users\user\C:/Users/user/AppData/Local/nvim-data/telescope_history

sakhnik avatar Oct 12 '21 14:10 sakhnik

I'm a long-time Vim user and recently switched to Neovim. I tried telescope with the shellslash option enabled, but it didn't work because of this bug in plenary.path. Telescope fails early and doesn't seem to be able to open the UI.

I tried the commit 5f70cf1 from @andreadev-it from his PR #371, and worked better: the Telescope UI is shown but fails on close or exit when saving the history.

The problem is that Windows accepts both '/' and '\' as path separators, and plenary.path doesn't take this into account.

Functions such as root, is_absolute, _split_by_separator, clean etc. must be updated to make it work.

I took andreadev-it/plenary.nvim and applied the changes aforementioned changes, and this fixed the issues in Telescope for me, see ba5e0171b8d5e7358cb2af2f165413a045f17411.

tajtiattila avatar Nov 28 '22 14:11 tajtiattila