made lazydev load only when in a lua file

This commit is contained in:
2026-04-16 09:59:52 +01:00
parent b76db809f2
commit ac461d7a6c
3 changed files with 42 additions and 3 deletions

View File

@@ -11,7 +11,6 @@
system = "x86_64-linux"; # change if needed system = "x86_64-linux"; # change if needed
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
pkgList = with pkgs; [ pkgList = with pkgs; [
# LSPs # LSPs
lua-language-server lua-language-server
vscode-langservers-extracted vscode-langservers-extracted

View File

@@ -1,7 +1,6 @@
vim.pack.add({ vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig", name = "lspconfig" }, { src = "https://github.com/neovim/nvim-lspconfig", name = "lspconfig" },
{ src = "https://github.com/saghen/blink.cmp", name = "blink" }, { src = "https://github.com/saghen/blink.cmp", name = "blink" },
{ src = "https://github.com/folke/lazydev.nvim", name = "lazydev" },
}) })
vim.lsp.config("lua_ls", { vim.lsp.config("lua_ls", {
@@ -81,9 +80,26 @@ require("blink.cmp").setup({
}, },
}) })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", { -- Lazy load lazydev when in lua file (no pun intended)
pattern = "lua", pattern = "lua",
callback = function() callback = function()
vim.pack.add({
{ src = "https://github.com/folke/lazydev.nvim", name = "lazydev" },
})
require("lazydev").setup() require("lazydev").setup()
require("blink.cmp").setup({ -- Reload blink with lazydev as a source
sources = {
-- add lazydev to your completion providers
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
-- make lazydev completions top priority (see `:h blink.cmp`)
score_offset = 100,
},
},
},
})
end, end,
}) })

View File

@@ -80,6 +80,30 @@
"rev": "e462b9a07b8166c3e8011f1dcbc6bf68b67cd8d7", "rev": "e462b9a07b8166c3e8011f1dcbc6bf68b67cd8d7",
"src": "https://github.com/Aasim-A/scrollEOF.nvim" "src": "https://github.com/Aasim-A/scrollEOF.nvim"
}, },
"telescope": {
"rev": "471eebb1037899fd942cc0f52c012f8773505da1",
"src": "https://github.com/nvim-telescope/telescope.nvim"
},
"telescope-file-browser": {
"rev": "3610dc7dc91f06aa98b11dca5cc30dfa98626b7e",
"src": "https://github.com/nvim-telescope/telescope-file-browser.nvim"
},
"telescope-fzf": {
"rev": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c",
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
"telescope-nerdy": {
"rev": "97b0914dece80204a777f04c94b9980da0f7ac88",
"src": "https://github.com/2kabhishek/nerdy.nvim"
},
"telescope-symbols": {
"rev": "a6d0127a53d39b9fc2af75bd169d288166118aec",
"src": "https://github.com/nvim-telescope/telescope-symbols.nvim"
},
"telescope-ui-select": {
"rev": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2",
"src": "https://github.com/nvim-telescope/telescope-ui-select.nvim"
},
"treesitter": { "treesitter": {
"rev": "4916d6592ede8c07973490d9322f187e07dfefac", "rev": "4916d6592ede8c07973490d9322f187e07dfefac",
"src": "https://github.com/nvim-treesitter/nvim-treesitter" "src": "https://github.com/nvim-treesitter/nvim-treesitter"