nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.71k stars 218 forks source link

BUG: can execute neo-tree commands #1441

Open dkumza opened 5 months ago

dkumza commented 5 months ago

Did you check docs and existing issues?

Neovim Version (nvim -v)

0.9.5

Operating System / Version

Fedora 39

Describe the Bug

E5108: Error executing lua ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:2: module 'nui.line' not found: no field package.preload['nui.line'] cache_loader: module nui.line not found cache_loader_lib: module nui.line not found no file './nui/line.lua' no file '/usr/share/luajit-2.1/nui/line.lua' no file '/usr/local/share/lua/5.1/nui/line.lua' no file '/usr/local/share/lua/5.1/nui/line/init.lua' no file '/usr/share/lua/5.1/nui/line.lua' no file '/usr/share/lua/5.1/nui/line/init.lua' no file './nui/line.so' no file '/usr/local/lib/lua/5.1/nui/line.so' no file '/usr/lib64/lua/5.1/nui/line.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './nui.so' no file '/usr/local/lib/lua/5.1/nui.so' no file '/usr/lib64/lua/5.1/nui.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:2: in main chunk [C]: in function 'require' ...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:4: in main chunk [C]: in function 'require' ...nvim/lazy/neo-tree.nvim/lua/neo-tree/sources/manager.lua:6: in main chunk [C]: in function 'require' ...re/nvim/lazy/neo-tree.nvim/lua/neo-tree/command/init.lua:3: in main chunk [C]: in function 'require' [string ":lua"]:1: in main chunk

Screenshots, Traceback

No response

Steps to Reproduce

1 from init.lue to ~/.config/nvim/lua/plugins 2 cant call :Neotree

Expected Behavior

should open tree

Your Configuration

-- leader = \\
vim.cmd("set expandtab")
vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2")
vim.opt.swapfile = false

local lazypath = vim.fn.stdpath("data") .. "/lazy/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",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- require("vim-options")
require("lazy").setup("plugins")
pysan3 commented 5 months ago

Nui.nvim is a necessary dependency for neo-tree.

Please follow the install instructions here: https://github.com/nvim-neo-tree/neo-tree.nvim?tab=readme-ov-file#minimal-example-for-lazy

dkumza commented 5 months ago

2024-04-23_09-01 2024-04-23_09-02

this is my neo-tree.lua return { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", }, config = function() local builtin = require('neo-tree') vim.keymap.set("n", "<C-n>", ":Neotree source=filesystem reveal=true position=left <CR>", {}) end }

Now I removed everything from that file and added again config. This error disapeared, but still cant use properly tree On 1st nvim startup i can't use C-n, it wont open tree. But if i write with hand :Neo... its working till i completly shut down my CLI tool.

pysan3 commented 5 months ago

This is because lazy.nvim is lazy loading neo-tree and config is only called after you load neo-tree and therefore keymap.set is also triggered only after neo-tree is loaded.

Please refer to the lazy.nvim README for more information but you should define key maps with the keys field in the plugin spec.

https://github.com/folke/lazy.nvim