feat: add lspconfig support, with wrapped lsp's
This commit is contained in:
40
lua/dot013/plugins/lsp.lua
Normal file
40
lua/dot013/plugins/lsp.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
local lsps = {
|
||||
["lua_ls"] = {
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
"nvim-lspconfig",
|
||||
after = function()
|
||||
local lsp = require("lspconfig")
|
||||
for k, v in pairs(lsps) do
|
||||
lsp[k].setup(v)
|
||||
end
|
||||
end,
|
||||
}
|
||||
12
neovim.nix
12
neovim.nix
@@ -12,6 +12,7 @@
|
||||
catppuccin-nvim
|
||||
indent-blankline-nvim
|
||||
lze
|
||||
nvim-lspconfig
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-treesitter-textobjects
|
||||
nvim-treesitter-textsubjects
|
||||
@@ -32,6 +33,10 @@
|
||||
tmux-nvim
|
||||
];
|
||||
|
||||
languageServers = with pkgs; [
|
||||
lua-language-server
|
||||
];
|
||||
|
||||
foldPlugins = builtins.foldl' (acc: next: acc ++ [next] ++ (foldPlugins (next.dependencies or []))) [];
|
||||
|
||||
startPluginsWithDeps = lib.unique (foldPlugins startPlugins);
|
||||
@@ -76,7 +81,12 @@ in
|
||||
name = "neovim-custom";
|
||||
pname = "nvim";
|
||||
|
||||
paths = [nvimPkg];
|
||||
paths = let
|
||||
wrappedNvim = pkgs.writeShellScriptBin "nvim" ''
|
||||
export PATH=${lib.makeBinPath languageServers}:$PATH
|
||||
${lib.getExe nvimPkg} "$@"
|
||||
'';
|
||||
in [wrappedNvim];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
|
||||
Reference in New Issue
Block a user