Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Strange behavior when using prompt_save_on_select_new_entry = false #179

Closed
3 tasks done
italovieira opened this issue Sep 18, 2023 · 1 comment
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@italovieira
Copy link

italovieira commented Sep 18, 2023

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

  1. Set oil prompt_save_on_select_new_entry to false
  2. Open Neovim in a empty directory (for a minimal example)
  3. :e .
  4. Write in the oil buffer file1 switch back to Normal mode and hit Enter (to call actions.select in file1)

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.
@italovieira italovieira added the bug Something isn't working label Sep 18, 2023
@stevearc
Copy link
Owner

Thanks for the report; should be fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants