stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.83k stars 109 forks source link

feature request: handle restricted UNC paths on Windows #404

Open matu3ba opened 4 months ago

matu3ba commented 4 months ago

Did you check existing requests?

Describe the feature

I'd like to be able to use oil.nvim with locally mounted UNC paths on Windows for fast looking into files after search via fd and gf to open a file and use map('n', '<leader>ex', [[<cmd>lua require("oil").open()<CR>]], opts) -- open dir of current buffer instead of cwd to traverse the directory.

Provide background

Upon execution of <leader>ex mapped to

I get

E5108: Error executing lua ...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:399: BufReadCmd Autokommandos für "oil://*": Vim(append):Error executing lua callback: ...fer/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/fs.lua:89: attempt to index local 'drive' (a nil value)                                                                                                                                                                                                                                                                  stack traceback:                                                                                                                                                                                                                                                                      ...fer/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/fs.lua:89: in function 'posix_to_os_path'                                                                                                                                                                                ...Local/nvim-data/lazy/oil.nvim/lua/oil/adapters/files.lua:229: in function 'normalize_url'                                                                                                                                                                                  ...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:966: in function 'load_oil_buffer'                                                                                                                                                                                ...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:1088: in function <...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:1087>                                                                                                                              [C]: in function 'edit'                                                                                                                                                                                                                                                       ...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:399: in function 'open'                                                                                                                                                                                           [string ":lua"]:1: in main chunk                                                                                                                                                                                                                                      stack traceback:                                                                                                                                                                                                                                                                      [C]: in function 'edit'                                                                                                                                                                                                                                                       ...r/AppData/Local/nvim-data/lazy/oil.nvim/lua/oil/init.lua:399: in function 'open'                                                                                                                                                                                           [string ":lua"]:1: in main chunk

and a never finishing loading dialog

      Loading
                                                         [     ====         ]

What is the significance of this feature?

nice to have

Additional details

Why? If one does frequent remote operations on Windows (in local ir VPN network), one will not want to mount remote pcs to hard drives like R:\ to prevent clashes of different machines or accidental copying/overwriting wrong machines.

The alternative is 1. to not use oil.nvim or 2. use yazi for inspection or 3. use :e \\ip\drive\pathtofile, 4. traverse via shell to the other files.

UNC paths with restrictions are quite feasible to implement, see https://github.com/ziglang/zig/blob/332fbb4b027a5529e58b1e46d785718a7faa75e6/lib/std/fs/path.zig#L1403.

If not, then please briefly explain scope of filepath shennanigans/complexity you're willing to handle in this plugin. Thanks for the plugin.

MrDwarf7 commented 1 month ago

Also requesting this - Where I work a lot of small documents are stored via UNC paths and being unable to use Nvim for navigation means either requiring direct access to a file (ie: :Oil myfile.txt) to move between them, or directly from the CLI, requiring to close nvim.