Comments (17)
I've managed to replicate it with a minimal config (with hl keys). It does not happen all the time, but it does trigger an out of order renderer.position.save that I still don't know why.
Investigating.
from neo-tree.nvim.
update: downgrading to 3.14 has fixed the issue for me:
use({ "nvim-neo-tree/neo-tree.nvim", tag = "3.14" })
from neo-tree.nvim.
@pysan3 yes my neovim version is newer than november, to be exact the last i'm updated i think is yesterday.
thanks for give me some related information, i will check it out and following the related infomation.
from neo-tree.nvim.
experiencing the same thing
from neo-tree.nvim.
Hi, I'm gonna take a look into this. Probably related to the changes I made.
from neo-tree.nvim.
Hello, I tried and couldn't reproduce it with neovim 0.9.5 and with neo-tree's repro.lua (as stated in the bug report template):
-- 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 = {
log_level = "trace",
log_to_file = "/tmp/neotree-repro.log",
filesystem = {
filtered_items = {
visible = true,
show_hidden_count = true,
hide_dotfiles = false,
hide_gitignored = true,
hide_by_name = {
-- '.git',
-- '.DS_Store',
-- 'thumbs.db',
},
never_show = {},
},
},
window = {
position = "right",
},
},
}
table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
I included your config as well.
It seems that AstroNvim overwrites some commands from neo-tree here. I'd suggest opening an issue there.
from neo-tree.nvim.
Thanks for your quick reply ,I'll open an issue at Astronvim.
from neo-tree.nvim.
the issue is gone when i fallback to 3.14, issue closed. Both neo-tree and astronvim cannot replicate it. issue closed.
from neo-tree.nvim.
@georgeguimaraes it does have to do with this commit you made (found with git bisect
): #1288
It seems to cause this bug in the custom hjkl based navigation described in this discussion: #163
I'm not sure if this is considered a bug/issue in neo-tree. If not, I can just remove this custom code from AstroNvim since there is no place for unstable code in there.
Thanks in advanced if you take a look at this! No worries if you don't have time!
from neo-tree.nvim.
You might have a better idea than me @georgeguimaraes if the PR introduced a bug or if the code in the linked comment (#163 (reply in thread)) has just always had a bug in it and this just exposed it. The code there seems relatively straightforward and that it should work, but I don't have a full understanding of the neo-tree internals like yourself. So it would be difficult for me to identify which side of the equation the bug would be considered
from neo-tree.nvim.
Looking at the video, it does not seem random at all. From what I can see, it is jumping to the currently active file in the buffer to the left.
More importantly, when I use the provided config and just add the custom h
/l
mappings, i don't see the same behavior:
-- 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 = {
log_level = "trace",
log_to_file = "/tmp/neotree-repro.log",
filesystem = {
filtered_items = {
visible = true,
show_hidden_count = true,
hide_dotfiles = false,
hide_gitignored = true,
hide_by_name = {
-- '.git',
-- '.DS_Store',
-- 'thumbs.db',
},
never_show = {},
},
window = {
mappings = {
h = function(state)
local node = state.tree:get_node()
if (node.type == "directory" or node:has_children()) and node:is_expanded() then
state.commands.toggle_node(state)
else
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
end
end,
l = function(state)
local node = state.tree:get_node()
if node.type == "directory" or node:has_children() then
if not node:is_expanded() then
state.commands.toggle_node(state)
else
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
end
end
end,
},
}
},
window = {
position = "right",
},
},
}
table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
I am using nvim version 0.9.4 on linux.
from neo-tree.nvim.
@cseickel it actually doesn't happen 100% of the time. It took me a while to replicate it. Also it doesn't always jump to the currently active file. Sometimes it will jump to a different directory I have recently toggled. I will see if I can get a specific set of actions to replicate it, but so far I have struggled to consistently replicate it without just sitting and doing a lot of actions in the file tree until it happens
from neo-tree.nvim.
Thanks so much for taking some time to investigate this @georgeguimaraes !
from neo-tree.nvim.
@mehalter I've proposed a fix. It's hard for me to debug it, because the issue doesn't happen a lot here. If you could try it, it would help a lot:
from neo-tree.nvim.
sorry to make this issue is resurrect. i'm still experience with the issue. i was reinstalling the plugin but it's still occour. if you don't mind let me add some information here. i hope is helpfull. thanks
Neovim Version
NVIM v0.10.0-dev-2501+gdbf6be296 Build type: RelWithDebInfo LuaJIT 2.1.1707061634
OS
arch linux
Configuration
my neo-tree configuration (click me)
local global = require('aquila.core.global')
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
},
config = function()
require("neo-tree").setup({
close_if_last_window = true,
window = {
width = 35,
mappings = {
["h"] = function(state)
local node = state.tree:get_node()
if node.type == 'directory' and node:is_expanded() then
require 'neo-tree.sources.filesystem'.toggle_directory(state, node)
else
require 'neo-tree.ui.renderer'.focus_node(state, node:get_parent_id())
end
end,
["l"] = function(state)
local node = state.tree:get_node()
if node.type == 'directory' then
if not node:is_expanded() then
require 'neo-tree.sources.filesystem'.toggle_directory(state, node)
elseif node:has_children() then
require 'neo-tree.ui.renderer'.focus_node(state, node:get_child_ids()[1])
end
elseif node.type == 'file' then
require("neo-tree.sources.filesystem.commands").open(state)
end
end,
-- copy to system clipboard
["Y"] = function(state)
local currentNode = state.tree:get_node()
local path = currentNode.path
vim.fn.setreg("+", path)
vim.notify("Copied to system clipboard", "info", {
title = "NeoTree",
timeout = 1000,
})
end,
-- paste from system clipboard
["P"] = function(state)
local clipboardPath = vim.fn.getreg("+")
if clipboardPath == "" then return end
local currentNode = state.tree:get_node()
local inputs = require("neo-tree.ui.inputs")
local confirmationMessage = "Are you sure you want to paste " .. clipboardPath
inputs.confirm(confirmationMessage, function(confirmed)
if not confirmed then return end
local success, error = pcall(function()
local sourcePath = vim.fn.fnameescape(clipboardPath)
local destinationPath = vim.fn.fnameescape(currentNode.path)
if currentNode.type == 'directory' then
vim.fn.system { "cp", "-r", sourcePath, destinationPath }
elseif currentNode.type == 'file' then
vim.fn.system { "cp", sourcePath, destinationPath }
end
end)
if not success then
local errorNotification = {
title = "NeoTree",
timeout = 1000,
}
vim.notify("Failed to paste from system clipboard", "error", errorNotification)
vim.cmd [[echohl ErrorMsg]]
return
end
-- reset clipboard
vim.fn.setreg("+", "")
require("neo-tree.sources.manager").refresh(state.name)
require 'neo-tree.ui.renderer'.focus_node(state, currentNode.id)
local successNotification = {
title = "NeoTree",
timeout = 1000,
}
vim.notify("Pasted from system clipboard", "info", successNotification)
end)
end
}
},
default_component_configs = {
git_status = {
symbols = {
added = global.icons.git.added,
modified = global.icons.git.modified,
}
},
},
filesystem = {
use_libuv_file_watcher = true,
follow_current_file = {
enabled = true,
leave_dirs_open = true
},
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
hide_by_name = {
"node_modules",
".git"
},
never_show = {
".DS_Store",
"thumbs.db"
},
},
commands = {
delete = function(state)
local inputs = require("neo-tree.ui.inputs")
local path = state.tree:get_node().path
local msg = "Are you sure you want to trash " .. path
inputs.confirm(msg, function(confirmed)
if not confirmed then return end
local success, error = pcall(function()
vim.fn.system { "trash", vim.fn.fnameescape(path) }
end)
if not success then
local errorNotification = {
title = "NeoTree",
timeout = 1000,
}
vim.notify("Failed to delete to trash", "error", errorNotification)
msg = "Skip trash? (permanent delete)"
inputs.confirm(msg, function(confirmed_delete_to_trash)
if not confirmed_delete_to_trash then return end
if state.tree:get_node().type == "directory" then
vim.fn.system { "rm", "-rf", vim.fn.fnameescape(path) }
else
vim.fn.system { "rm", vim.fn.fnameescape(path) }
end
require("neo-tree.sources.manager").refresh(state.name)
end)
end
require("neo-tree.sources.manager").refresh(state.name)
end)
end,
}
},
})
vim.keymap.set("n", "<Leader>e", '<cmd>Neotree toggle<CR>')
vim.keymap.set("n", "<Leader>E", '<cmd>Neotree reveal<CR>')
end
}
NeoTree Version
v3.17
Description
open folder with l
or enter
key, make cursor random jump, it will jump some line above or below from old cursor position(before open folder) . but it's randomly happen, i think it's happen when i moving fast in neo-tree but i'm not sure with this.
from neo-tree.nvim.
@rizkyilhampra Could you join the discussion here? #1374
It might be caused by an upstream issue in neovim and maybe not...
Do you remember when you installed that neovim? If it's newer than November, it might be neo-tree's position restore mechanism conflicting with neovim/neovim#27720.
from neo-tree.nvim.
Sorry, wrong link. Updated.
from neo-tree.nvim.
Related Issues (20)
- [QUESTION] I try to add the root path from neo-tree to cokline sep HOT 11
- BUG: Floating neo-tree moves upon toggling file preview HOT 1
- BUG: Buffer with this name already exists HOT 13
- FEATURE: Show source selector tabs in the tabline HOT 16
- BUG: Default ACLs ignored when adding new file HOT 9
- BUG: Renaming when using alternative keyboard layout transliterates the name of the file into the layout HOT 15
- FEATURE: Put cursor in the beginning of line in normal mode HOT 17
- BUG: image preview doesn't work HOT 1
- Help Request: SignColumn transparency HOT 2
- BUG: icon and padding on the left disappears when clicking on the git signs HOT 3
- QUESTION: Changing default root location HOT 1
- FEATURE: Add 'refresh' command to force Neo-tree refresh HOT 2
- BUG: opening up a file via Neotree results in gopls not honoring the package environment (on Windows) HOT 15
- BUG: Error while focusing Neotree window on insert mode HOT 7
- BUG: neo-tree leaves a 0 buffer in jumps list
- BUG: Slow work when remap keys HOT 2
- BUG: auto select copied file not work sometimes HOT 3
- FEATURE: git status in sub directories (filesystem)
- Do not close popup with <Esc> in INSERT mode HOT 1
- Huge error in Windows Deletion command, deletes wrong dir.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo-tree.nvim.