Cannot figure out how to configure LSP with lazy

Hi, I’m trying to write my own config. I’ve been using kickstart.nvim, but I want to fully rewrite my config to actually understand what’s happening. Problem is I have no clue where to find the info I need.

My approach to this is basically, I want a feature so I’ll add it. This got me to set some basic vim options and load lazy (because I did understand those docs). Then I wanted to add an lsp for auto completion so I don’t trip over my own type aids. For this I looked at my old (kickstart.nvim) config which was doing some funky things I didn’t understand, so then I went to the lazy distro sourcecode, as that is made by the creator of lazy so should have the proper way to use the plugin manager. Problem is, very quickly I also stopped understanding that, and it used some Util file in the lazy distro, which I didn’t want to copy. At that point I might as well just use lazyvim. Then finally I went to the nvim-lspconfig github, which made even less sense to me…

Long story short, I want to make my own config, but I don’t know where to start/ how to start/ what to even read up on.

That being said, does anyone have a very simple minimum viable config for an LSP config (so that I have a place to start) or a resource that goes over all the configuration that doesn’t assume basically any prior knowledge of how to configure neovim.

Thanks in advance!

Hi

I only recently started to use neovim, and I really like these introductory videos, where many principles concerning configuration are well explained

Ok, I’m far from an expert and a bit late to reply. I just recently started out doing my own Neovim configuration from scratch. But this may be valuable for other newcomers.

I found Typecraft’s videos on configuring Neovim from scratch simple and easy to follow: https://www.youtube.com/watch?v=zHTeCSVAFNY

I also read the documentation on Lua in Neovim: Lua - Neovim docs

For more inspiration I read and studied the kickstart.nvim configuration setup, which actually was what I started with when first trying out Neovim: GitHub - nvim-lua/kickstart.nvim: A launch point for your personal nvim configuration

It is a good idea to do your own first configuration in separate steps. Don’t try to configure everything in one big go. After each step you can check and ensure everything works as expected, before moving on to the next step.

At my very first attempts I put print statements like print("Sourcing init.lua") in my Lua config files, just to see and learn which order Neovim was picking up my Lua config files in.

Based on how I approached it I would suggest:

  1. Decide on how you want to organize and structure your configuration files. My current organization and structure is shown below. My top level init.lua file just imports (requires) on the rest of my Lua config files.
  2. Add your general options to one config file and your general keymaps to another config file. Make sure that works.
  3. Add a Lua config file for installing and setting up lazy.nvim. I setup lazy.nvim to read which plugins to install and setup from plugin-specific files in a dedicated plugin directory as shown below.
  4. Add the plugins you want to install and set them up one by one. Check that each plugin works as expected before moving on. Also begin with the simplest possible configuration for each plugin.
~/.config/nvim/                      # Root directory        
               init.lua              # Main config file. Contains just requires.
~/.config/nvim/lua/paco/             # Root directory for my configuration     
                        options.lua  # General options
                        keymaps.lua  # General keymaps
                        lazy.lua     # Installation and setup of lazy.nvim
~/.config/nvim/lua/paco/lazy-plugins/     # Root directory for lazy.nvim plugins
                                    ...   # One lua-file per lazy.nvim plugin