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

Unable to import plugins from its subfolders #825

Closed
3 tasks done
ghost opened this issue May 25, 2023 · 9 comments
Closed
3 tasks done

Unable to import plugins from its subfolders #825

ghost opened this issue May 25, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented May 25, 2023

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.0

Operating system/version

Ubuntu v23.04

Describe the bug

Error Message

Error detected while processing /home/swayam25/.config/nvim/init.lua:
E5113: Error while calling lua chunk: .../.local/share/nvim/lazy/lazy.nvim/lua/l
azy/core/util.lua:222: attempt to call method 'gsub' (a nil value)
stack traceback:
        .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:222: in func
tion 'get_unloaded_rtp'
        .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:246: in func
tion 'find_root'
        .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:258: in func
tion 'lsmod'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/plugin.lua:275: in func
tion 'import'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/plugin.lua:250: in func
tion 'normalize'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/plugin.lua:238: in func
tion 'normalize'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/plugin.lua:35: in funct
ion 'parse'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/plugin.lua:395: in func
tion 'load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:36: in funct
ion 'setup'
        ...yam25/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:75: in funct
ion 'setup'
        /home/swayam25/.config/nvim/lua/plugins/init.lua:18: in main chunk
        [C]: in function 'require'
        /home/swayam25/.config/nvim/init.lua:9: in main chunk

File Structure

.config/nvim
├── init.lua
├── lazy-lock.json
├── lua
│   ├── autocmds.lua
│   ├── keymaps.lua
│   ├── options.lua
│   └── plugins
│       ├── code
│       │   ├── coc.lua
│       │   ├── comment.lua
│       │   ├── copilot.lua
│       │   ├── luasnip.lua
│       │   ├── nvim_cmp.lua
│       │   ├── ultimate_autopair.lua
│       │   └── vim_illuminate.lua
│       ├── init.lua
│       ├── langs
│       ├── ui
│       │   ├── alpha.lua
│       │   ├── bufferline.lua
│       │   ├── catpuccin.lua
│       │   ├── gitsigns.lua
│       │   ├── mini_animate.lua
│       │   ├── neoscroll.lua
│       │   ├── neo_tree.lua
│       │   ├── nvim_treesitter.lua
│       │   ├── telescope.lua
│       │   ├── vim_illuminate.lua
│       │   └── which_key.lua
│       └── version_control
│           └── lazygit.lua
└── stylua.toml

6 directories, 26 files

File: nvim/lua/plugins/init.lua

-- Vim.fn.stdpath("data") is in Linux systems: ~/.local/nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

-- If it's not found - indicating that it's not found - Git clone it (~)_(~)
if not vim.loop.fs_stat(lazypath) then
    -- Show a lovely message indicating that we're boostrapping lazy :)
    print(" Bootstrapping lazy.nvim!")

    --  lazy.nvim recommends to use vim.fn.system but, via `vim.cmd("!...")` we can know the progress ;)
    vim.cmd("!git clone --filter=blob:none https://github.com/folke/lazy.nvim.git --branch=stable " .. lazypath)
    print(" Done!")
end

-- Add it to RTP. So, we can require it later on
vim.opt.rtp:prepend(lazypath)

-- Import plugins from `lua/plugins`
require("lazy").setup(
    { 
        import = {
            "plugins.ui",
            "plugins.code",
            "plugins.langs",
            "plugins.version_control"
        }
        
    }, {
    defaults = {
        -- Lazy-load by default
        lazy = true,
        -- Use the latest version of the plugin (screw semantic versioning)
        version = false,
    },
    install = {
        -- Install missing plugins.
        missing = true,
        colorscheme = {
            -- These are a list of plugins to load when installing a plugin
            -- It's listed on order. catppuccin -> habamax
            "catppuccin",
            "habamax",
        },
    },
    performance = {
        rtp = {
            disabled_plugins = {
                -- I can disable more plugins such as `rplugin` and `netrw`, it'll decrease functionality.
                "gzip",
                "tarPlugin",
                "tohtml",
                "zipPlugin",
                "matchit",
                "matchparen",
                "netrwPlugin",
                "rplugin",
                "nvim",
                "tutor",
                -- "spellfile",
            },
        },
    },
})

File: nvim/init.lua

-- Enable the experimental new loader.
vim.loader.enable()

-- Set some options.
require("options")
require("autocmds")

-- Require lazy.nvim.
require("plugins")

-- Theme
vim.cmd.colorscheme("catpuccin")

vim.schedule(
    function()
        require("keymaps")
    end
)

Steps To Reproduce

Run nvim

Expected Behavior

It should load all the plugins with its subfolders

@ghost ghost added the bug Something isn't working label May 25, 2023
@folke
Copy link
Owner

folke commented May 25, 2023

You have nothing in langs?

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@ghost
Copy link
Author

ghost commented May 25, 2023

You have nothing in langs?

No, langs folder is empty

@folke
Copy link
Owner

folke commented May 25, 2023

But you are importing it. So either put files in there or dont import it?

@ghost
Copy link
Author

ghost commented May 25, 2023

I tried by removing it from import, still it is showing the same error.

@folke
Copy link
Owner

folke commented May 25, 2023

https://github.com/folke/lazy.nvim#%EF%B8%8F-importing-specs-config--opts

import=... shoudl be a string, not a table

@ghost
Copy link
Author

ghost commented May 25, 2023

Can you please say how can I import all the plugins with its subfolders without any errors?

@folke
Copy link
Owner

folke commented May 25, 2023

Just add multiple imports.

{
  {import = "..."},
  {import = "..."},
}

@ghost
Copy link
Author

ghost commented May 25, 2023

Dear @folke ,

I would like to express my deepest gratitude for your exceptional support and expertise in resolving the issue I encountered with lazy.nvim. Your prompt response and diligent efforts in addressing my problem were truly remarkable.

Your in-depth knowledge and commitment to delivering a high-quality solution were evident throughout our interaction. Thanks to your guidance, I was able to overcome the obstacles I faced and continue leveraging the full potential of lazy.nvim in my projects.

I am sincerely grateful for your generosity in sharing your time and expertise. Your dedication to the open-source community is truly commendable, and it is developers like you who make the editors nvim a better place. Once again, thank you for your invaluable assistance.

With sincere appreciation,
@swayam25

@folke
Copy link
Owner

folke commented May 25, 2023

Thanks!

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

1 participant