๐ง Second Brain
Search
Neovim Setup
# VS Code style
See Neovim set up like VS Code.
# Nvim Setup
Latest with Lazy.nvim even:
How I Setup LSP In Neovim For An Amazing Dev Experience - Full Guide - YouTube
# LSP with lazy.nvim
I was struggling a lot to set up LSP with lazy.nvim
. There was the nvim-lspconfig
, the nvim-cmp
(for pop-up window), mason.nvim
for easy install, and none-ls
(previously null-ls).
I had lsp-zero
in my old config, and in lazy.nvim, I tried several setups to put it in different config = function()
blocks.
As I might guess, others are struggling too, the video and especially the dotfiles from Josean Martinez just solved it for me. I saw he skipped lsp-zero with lazy and I could understand how to set up.
I ended up copying his setup and just replacing it with my shortcuts and configs. Here are the most important parts which were important to me.
# LSP Setup
Add an lsp folder to lazy.lua
(replace josean with your name)
|
|
- Add a
nvim-cmp.lua
for proper auto-compmlete, see dev-environment-files/.config/nvim/lua/josean/plugins/nvim-cmp.lua at main ยท josean-dev/dev-environment-files ยท GitHub - Copy his
lsp folder and check what he is doing. notice there is no lsp-zero (not sure if that can still be used?)
- I enjoy that in
lspconfig.lua
, he configures, each language server is configured manually, as this gives a sense of control that I missed before when I just assumed it would work (but probably didn’t all the time). ensure_installed
with the installed packages you want can be configured easily inmason.lua
- and setting for linting can be set in one place under
none-ls.lua
.
- I enjoy that in
After I copied his configs and commented out mine, it just worked. So I could simply replace his shortcuts and configs with mine, and it just worked, and my frustration went back to joy. I have no agenda to promote his content, but just to help others who might struggle too.
# Speed update
Also, a nice side effect: my startup time (Neovim StartUp Times) went through the roof and starts now in 76 ms, even with 82 plugins ๐. I hope that helps; my LSP configs I ended up with can be found in my dotfiles, too.
One thing I couldn’t figure out was the format on save; didn’t work for me in Python. I had this before that worked:
|
|
But I was hoping to include it in the none-ls.lua
in
on_attach function. If anyone has a hint, it would be super appreciated.
Origin:
References:
Created 2024-02-18