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: Moving a file via double dot causes tree to bug out #1556

Open
3 tasks done
bryanvaz opened this issue Sep 2, 2024 · 0 comments · May be fixed by #1647
Open
3 tasks done

BUG: Moving a file via double dot causes tree to bug out #1556

bryanvaz opened this issue Sep 2, 2024 · 0 comments · May be fixed by #1647
Labels
bug Something isn't working

Comments

@bryanvaz
Copy link

bryanvaz commented Sep 2, 2024

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

0.10.0

Operating System / Version

macos 14.6.1

Describe the Bug

In an open neotree float, when trying to move a file in the directory structure up one level using double dots (..), the directory tree after the move shows the double dots as its own directory instead of refreshing.

Manually refreshing neotree with (R) and closing and reopening the directory tree does not refresh/resolve the tree resulting in the double dot folder persisting.

The actual directory tree on the file system does not have a double dot folder and the tree correctly reflects the move.

Screenshots, Traceback

Neotree float window after moving using double dots:
Screenshot 2024-09-02 at 10 28 53 AM

Moving a file to another directory using double dots:
Screenshot 2024-09-02 at 10 33 28 AM

Correct directory structure present on fs:
Screenshot 2024-09-02 at 10 44 03 AM

Steps to Reproduce

  1. Open a project with a directory structure at least 3 levels deep with multiple directories
  2. Navigate to a file at least two levels deep
  3. Move the file to a sister directory using the double dot notation (one level up, and then one level down)
  4. After the move Neotree will show a double dot folder (..) in the current directory and represent the folder structure of the upper level directory in the new double dot folder. The sister folder (target dir) will also be opened in the double dot directory and the moved file will show up there

Expected Behavior

  1. It should move the file using the notation (currently performs this function correctly)
  2. Then refresh the directory tree in the current directory (source dir)
  3. Then resolve and open the target directory (optional, but I assume this was the intended behaviour)

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@bryanvaz bryanvaz added the bug Something isn't working label Sep 2, 2024
@pynappo pynappo linked a pull request Jan 2, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant