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: File is deleted instead of moved when containing dir is also deleted #162

Closed
3 tasks done
Amleto opened this issue Aug 25, 2023 · 3 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@Amleto
Copy link

Amleto commented Aug 25, 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.1 (winget)

Operating system/version

win10 22h2

Describe the bug

There is a file within a directory. I attempt to move the file up one level, and remove the (now empty) directory. The directory is deleted (I think before the file move is attempted), and the file is not moved. The file is also deleted. There is an exception message.

image
image

Steps To Reproduce

  1. nvim -u repro.lua
  2. :Oil
  3. go into 'foo' dir
  4. 'dd' to delete the file
  5. '-' to go back to root
  6. 'p' to put the file in the root
  7. delete 'foo' dir
  8. ':w' to make the changes, 'o' to confirm

Expected Behavior

Expected the file to be moved, and then the directory to be deleted.

Directory structure

foo/file.lua

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 = {
  "folke/tokyonight.nvim",
  {
        "stevearc/oil.nvim",
        config = function()
            require("oil").setup({
              -- add any needed settings here
            })
        end,
  },
  -- add any other plugins here
}
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.
@Amleto Amleto added the bug Something isn't working label Aug 25, 2023
@stevearc
Copy link
Owner

You have found the first bug in the action resolution logic! Thanks for the report! Should be fixed now.

@Amleto
Copy link
Author

Amleto commented Aug 26, 2023

ooh, is there a bounty?! XD

Many thanks for oil + fix

@stevearc
Copy link
Owner

Just these bounteous thanks for helping to make the plugin better!

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