bug: Strange behavior when using prompt_save_on_select_new_entry = false
#179
Closed
Description
Did you check the docs and existing issues?
- I have read the docs
- I have searched the existing issues
Neovim version (nvim -v)
0.9.2
Operating system/version
Arch Linux
Describe the bug
I don't know if it's actually a bug or just a strange behavior, but when I set prompt_save_on_select_new_entry = false
any new file is created as a directory.
Steps To Reproduce
- Set oil
prompt_save_on_select_new_entry
to false - Open Neovim in a empty directory (for a minimal example)
- :e .
- Write in the oil buffer
file1
switch back to Normal mode and hit Enter (to call actions.select infile1
)
After these steps a new oil buffer is opened using file1
as the new directory.
Expected Behavior
I would expect it to create as a new file since oil by default creates a new file when using any name not ending in / (e.g. file1
) and a new dir when using a name ending in / (e.g. dir1/
).
Directory structure
file1
Repro
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"stevearc/oil.nvim",
opts = {
prompt_save_on_select_new_entry = false,
}
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check the bug with a clean config?
- I have confirmed that the bug reproduces with
nvim -u repro.lua
using the repro.lua file above.