BUG: directories beginning or ending with symbol cause error in filesystem command set_root
#1352
Closed
3 tasks done
Labels
bug
Something isn't working
Did you check docs and existing issues?
Neovim Version (nvim -v)
NVIM v0.9.2
Operating System / Version
Windows 11 22H2
Describe the Bug
On Windows systems, Neo-tree throws an error when using the filesystem source
set_root
command to set the current working directory when a path segment begins or ends with a symbol (such as(
,&
, etc.). This type of path is common with web projects that use "dynamic" paths such asfoo/(bar)/baz
. This is almost the same issue reported in #889, and is part of a bigger issue of properly handling Windows paths.The Neo-tree view is able to properly update itself to the correct root node, but Neovim will not have the current working directory updated (confirmed with
:pwd
).Root cause:
This is a Windows-specific path problem. The
set_cwd
function useslcd
,tcd
, orcd
commands to set the working directory (see snippet below). On Windows the argument passed to these commands is having the path separator\
treated as an escape character for a symbol such as\(
. The path separator is lost and the final path is treated asfoo(bar)
instead offoo\(bar)
.neo-tree.nvim/lua/neo-tree/sources/manager.lua
Lines 353 to 360 in f3941c5
Screenshots, Traceback
Steps to Reproduce
Note that these steps must be followed on a Windows system to reproduce the issue.
nvim -u repro.lua
(close Neovim)foo
)foo/(bar)
)foo
withnvim -u repro.lua ./foo
:Neotree filesystem toggle left
(bar)
directory and press.
to set root and observe error<CR>
and observe Neo-tree properly updates the view:pwd
and observe Neovim's working directory is not correctly setExpected Behavior
Neo-tree is able to set neovim current working directory (
cd
,lcd
,tcd
) without errors on Windows systems.Your Configuration
The text was updated successfully, but these errors were encountered: