stevearc / oil.nvim

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

bug: Suddenly getting 'E17' 'is-a-directory' error on directory save after config change #252

Closed elmarsto closed 9 months ago

elmarsto commented 10 months ago

EDIT: see comment below for correct diagnosis and solution. It's kind of interesting. I'm not sure if it's expected behaviour but it is surprising. Leaving this here for other folks to learn from.

Did you check the docs and existing issues?

Neovim version (nvim -v)

b3c24f4b3

Operating system/version

NixOS 23.11

Describe the bug

After upgrading to this commit: https://github.com/stevearc/oil.nvim/commit/b3c24f4b3b2d38483241292a330cd6eb00734dac (NOTE: this is not the cause, see comment below )

I'm now seeing image

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

Open nvim :e .

:w ### Expected Behavior I get asked if I want to write to the dir ### Directory structure _No response_ ### Repro ```Lua I don't have time for this, I'm under deadline pressure, but FYI yeah ``` ### Did you check the bug with a clean config? - [X] I have confirmed that the bug reproduces with `nvim -u repro.lua` using the repro.lua file above.
elmarsto commented 10 months ago

Interestingly, I do get asked (by oil) when I do ZZ (:wqa equivalent)

elmarsto commented 10 months ago

OK I fixed this. It was a config error. BUT an interesting one!

Turns out if you tell oil that ':' is a hotkey for actions.open_cmdline_dir this happens.

The prompt that's pulled up by open_cmdline_dir will throw E17 errors if you try to write

elmarsto commented 10 months ago

Leaving open for package author to decide if this is actually a bug, and if so, if it's fixable (might just be a neovim thing)

stevearc commented 9 months ago

This is not a bug. actions.open_cmdline_dir is supposed to be used to quickly run commands on the current directory. Binding it to : is not recommended, because it interferes with anything you would want to do with command mode. I would recommend using a different keybind (<leader>: perhaps).