Search code examples
luaneovim

Neovim init.lua sourcing not working when trying to install Lazy.nvim


I am new to Neovim s (and vim in general) so I might be missing something obvious. Anyway, I am trying to follow a video to setup a Neovim to replace my IDE (VSCode). This video start with setting up the Lazy plugin manager.

I've got a super simple setup and I am only trying to install Lazy but my init.lua file is giving me init.lua:1: number expected whenever I try to source it.

Here's my ~/.config/nvim directory:

╰─❯ tree
.
├── init.lua
└── lua
    ├── config
    │   └── init.lua
    ├── plugins
    └── util

5 directories, 2 files

Here is my ~/.config/nvim/init.lua

require("config")

And here is my ~/.config/nvim/lua/config/init.lua

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)


vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct

-- Initialise Lazy by installing some basic plugins
require("lazy").setup({
  "folke/which-key.nvim",
  { "folke/neoconf.nvim", cmd = "Neoconf" },
  "folke/neodev.nvim",
})

What is incorrect with my setup? I can't figure it out and don't understand where I am going wrong. This looks just like the video I am watching and the author of that shows the Lazy plugin loaded and working.


Solution

  • keep your config but go to ~/.local/share/ and delete the nvim folder, then restart your terminal, start nvim and it should load up lazyvim.