This commit is contained in:
nikos 2025-10-11 09:19:36 +03:00
parent e528c11fab
commit 33321d5cd3
4 changed files with 141 additions and 143 deletions

View file

@ -42,6 +42,7 @@ in
devenv devenv
devbox devbox
tldr tldr
biome
]; ];
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;

View file

@ -78,6 +78,7 @@ vim.opt.tabstop = 4
vim.opt.splitkeep = "screen" vim.opt.splitkeep = "screen"
require "my.keymaps" require "my.keymaps"
require "my.lsp"
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("HighlightYank", {}), group = vim.api.nvim_create_augroup("HighlightYank", {}),

71
nvim/lua/my/lsp.lua Normal file
View file

@ -0,0 +1,71 @@
vim.lsp.config.svelte = {}
vim.lsp.config.gopls = {}
vim.lsp.config.ts_ls = {}
vim.lsp.config.expert = {
cmd = { vim.fn.expand '$HOME/.local/bin/expert' },
root_markers = { 'mix.exs', '.git' },
filetypes = { 'elixir', 'eelixir', 'heex' },
}
vim.lsp.config.lua_ls = {
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
}
vim.lsp.config.intelephense = {
init_options = { licenceKey = vim.fn.stdpath("config") .. "/intelephense-license" },
settings = {
intelephense = {
files = { maxSize = 1000000000 },
format = { enable = false },
stubs = require "intelephense_stubs",
},
},
}
vim.lsp.config.nixd = {
settings = {
formatting = {
command = { "nixfmt" },
},
},
}
vim.lsp.enable { 'expert', 'lua_ls', 'svelte', 'intelephense', 'nixd', 'gopls', 'ts_ls' }
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then
return
end
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold" }, {
callback = vim.lsp.buf.document_highlight,
buffer = args.buf,
})
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
callback = vim.lsp.buf.clear_references,
buffer = args.buf,
})
end
end,
})

View file

@ -1,154 +1,79 @@
local function config() -- local function config()
local lspconfig = require "lspconfig" -- local lspconfig = require "lspconfig"
require "neodev".setup()
local capabilities = {} -- local capabilities = {}
local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp") -- local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
if has_cmp then -- if has_cmp then
capabilities = cmp_lsp.default_capabilities() -- capabilities = cmp_lsp.default_capabilities()
end -- end
--
-- local eslint = {
-- lintCommand = [[eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}]],
-- lintIgnoreExitCode = true,
-- lintStdin = true,
-- lintFormats = {
-- "%f(%l,%c): %tarning %m",
-- "%f(%l,%c): %rror %m",
-- },
-- lintSource = "eslint",
-- }
local eslint = { -- local shellcheck = {
lintCommand = [[eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}]], -- lintCommand = "shellcheck -f gcc -x",
lintIgnoreExitCode = true, -- lintSource = "shellcheck",
lintStdin = true, -- lintFormats = {
lintFormats = { -- "%f:%l:%c: %trror: %m",
"%f(%l,%c): %tarning %m", -- "%f:%l:%c: %tarning: %m",
"%f(%l,%c): %rror %m", -- "%f:%l:%c: %tote: %m",
}, -- },
lintSource = "eslint", -- }
} --
-- local servers = {
local shellcheck = { -- efm = {
lintCommand = "shellcheck -f gcc -x", -- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" },
lintSource = "shellcheck", -- init_options = { documentFormatting = true },
lintFormats = { -- settings = {
"%f:%l:%c: %trror: %m", -- rootMarkers = { ".git/" },
"%f:%l:%c: %tarning: %m", -- languages = {
"%f:%l:%c: %tote: %m", -- typescript = { eslint },
}, -- typescriptreact = { eslint },
} -- javascript = { eslint },
-- javascriptreact = { eslint },
local servers = { -- sh = { shellcheck },
efm = { -- },
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" }, -- },
init_options = { documentFormatting = true }, -- },
settings = { -- rust_analyzer = {
rootMarkers = { ".git/" }, -- assist = {
languages = { -- importGranularity = "module",
typescript = { eslint }, -- importPrefix = "self",
typescriptreact = { eslint }, -- },
javascript = { eslint }, -- cargo = {
javascriptreact = { eslint }, -- buildScripts = {
sh = { shellcheck }, -- enable = true,
}, -- },
}, -- },
}, -- procMacro = {
gopls = {}, -- enable = true,
nixd = { -- },
settings = { -- },
formatting = { -- gleam = {},
command = { "nixfmt" }, -- denols = {
}, -- root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
}, -- },
}, -- zls = {},
rust_analyzer = { -- bashls = {},
assist = { -- }
importGranularity = "module", -- end
importPrefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
lua_ls = {
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
},
lexical = {
cmd = { "lexical" },
},
gleam = {},
ts_ls = {
root_dir = function(filename, _)
local deno = lspconfig.util.root_pattern("deno.json", "deno.jsonc")(filename)
if deno then
return nil
end
return lspconfig.util.root_pattern("package.json")(filename)
end,
single_file_support = false,
},
svelte = {},
denols = {
root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
},
intelephense = {
init_options = { licenceKey = vim.fn.stdpath("config") .. "/intelephense-license" },
settings = {
intelephense = {
files = { maxSize = 1000000000 },
format = { enable = false },
stubs = require "intelephense_stubs",
},
}
},
zls = {},
bashls = {},
}
for lsp, settings in pairs(servers) do
lspconfig[lsp].setup(vim.tbl_extend("force", { capabilities = capabilities }, settings))
end
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then
return
end
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold" }, {
callback = vim.lsp.buf.document_highlight,
buffer = args.buf,
})
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
callback = vim.lsp.buf.clear_references,
buffer = args.buf,
})
end
end,
})
end
return { return {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { "folke/neodev.nvim", }, dependencies = { "folke/neodev.nvim", },
config = config, config = function()
require("neodev").setup()
end,
}, },
{ {
"j-hui/fidget.nvim", "j-hui/fidget.nvim",