Shougo / defx.nvim

:file_folder: The dark powered file explorer implementation for neovim/Vim8
MIT License
1.17k stars 86 forks source link

Windows 10 cwd path problem #332

Closed rislah closed 2 years ago

rislah commented 2 years ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

Thank you for this plugin

Trying to open Defx in the current folder on Windows.

On my Linux system, everything is ok.

On Windows, for example cwd = C:\Users\usr\AppData\Local\nvim, doing Defx C:\Users\usr\AppData\Local\nvim or Defx <C-r>=expand('%:p:h')<CR> will result in error: "C:\Users\usr\AppData\Local\nvim\C:UsersusrAppDataLocalnvim" is not a readable directory.

This is not a problem with nvim on windows, as netrw handles it properly.

Expected

Environment Information

defx: health#defx#check

defx.nvim

nvim: health#nvim#check

Configuration

Performance

Remote Plugins

nvim-treesitter: require("nvim-treesitter.health").check()

Installation

Parser/Features H L F I J

provider: health#provider#check

Clipboard (optional)

Python 3 provider (optional)

Python virtualenv


## Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

```vim
" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/plugin/
nnoremap ,- :Defx <C-r>=expand('%:p:h')<CR><CR>

The reproduce ways from neovim/Vim starting (Required!)

  1. :Defx <C-r>=expand('%:p:h')

Generate a logfile if appropriate

Nothing in logs

Screen shot (if possible)

https://i.imgur.com/Ag9eR0k.png

Upload the log file

rislah commented 2 years ago

turning the slashes around and doing Defx C:/Users/usr/AppData/Local/nvim fixes the problem

related issues https://github.com/neovim/neovim/issues/2471 https://github.com/neovim/neovim/issues/7117

should be fixed on nvim, as i stated netrw handles it properly

Shougo commented 2 years ago

You need to escape \ in the path. Because \ is special character in defx.nvim command line.

Defx <C-r>=escape(expand('%:p:h'), '\')