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: can execute neo-tree commands #1441

Open
3 tasks done
dkumza opened this issue Apr 22, 2024 · 3 comments
Open
3 tasks done

BUG: can execute neo-tree commands #1441

dkumza opened this issue Apr 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dkumza
Copy link

dkumza commented Apr 22, 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.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")
@dkumza dkumza added the bug Something isn't working label Apr 22, 2024
@pysan3
Copy link
Collaborator

pysan3 commented Apr 22, 2024

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
Copy link
Author

dkumza commented Apr 23, 2024

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
Copy link
Collaborator

pysan3 commented May 1, 2024

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

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