nvum
This commit is contained in:
parent
e528c11fab
commit
33321d5cd3
4 changed files with 141 additions and 143 deletions
1
home.nix
1
home.nix
|
|
@ -42,6 +42,7 @@ in
|
|||
devenv
|
||||
devbox
|
||||
tldr
|
||||
biome
|
||||
];
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ vim.opt.tabstop = 4
|
|||
vim.opt.splitkeep = "screen"
|
||||
|
||||
require "my.keymaps"
|
||||
require "my.lsp"
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
group = vim.api.nvim_create_augroup("HighlightYank", {}),
|
||||
|
|
|
|||
71
nvim/lua/my/lsp.lua
Normal file
71
nvim/lua/my/lsp.lua
Normal 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,
|
||||
})
|
||||
|
|
@ -1,154 +1,79 @@
|
|||
local function config()
|
||||
local lspconfig = require "lspconfig"
|
||||
require "neodev".setup()
|
||||
-- local function config()
|
||||
-- local lspconfig = require "lspconfig"
|
||||
|
||||
local capabilities = {}
|
||||
-- local capabilities = {}
|
||||
|
||||
local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if has_cmp then
|
||||
capabilities = cmp_lsp.default_capabilities()
|
||||
end
|
||||
-- local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
-- if has_cmp then
|
||||
-- capabilities = cmp_lsp.default_capabilities()
|
||||
-- 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 = {
|
||||
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 shellcheck = {
|
||||
lintCommand = "shellcheck -f gcc -x",
|
||||
lintSource = "shellcheck",
|
||||
lintFormats = {
|
||||
"%f:%l:%c: %trror: %m",
|
||||
"%f:%l:%c: %tarning: %m",
|
||||
"%f:%l:%c: %tote: %m",
|
||||
},
|
||||
}
|
||||
|
||||
local servers = {
|
||||
efm = {
|
||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" },
|
||||
init_options = { documentFormatting = true },
|
||||
settings = {
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
typescript = { eslint },
|
||||
typescriptreact = { eslint },
|
||||
javascript = { eslint },
|
||||
javascriptreact = { eslint },
|
||||
sh = { shellcheck },
|
||||
},
|
||||
},
|
||||
},
|
||||
gopls = {},
|
||||
nixd = {
|
||||
settings = {
|
||||
formatting = {
|
||||
command = { "nixfmt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
rust_analyzer = {
|
||||
assist = {
|
||||
importGranularity = "module",
|
||||
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
|
||||
-- local shellcheck = {
|
||||
-- lintCommand = "shellcheck -f gcc -x",
|
||||
-- lintSource = "shellcheck",
|
||||
-- lintFormats = {
|
||||
-- "%f:%l:%c: %trror: %m",
|
||||
-- "%f:%l:%c: %tarning: %m",
|
||||
-- "%f:%l:%c: %tote: %m",
|
||||
-- },
|
||||
-- }
|
||||
--
|
||||
-- local servers = {
|
||||
-- efm = {
|
||||
-- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" },
|
||||
-- init_options = { documentFormatting = true },
|
||||
-- settings = {
|
||||
-- rootMarkers = { ".git/" },
|
||||
-- languages = {
|
||||
-- typescript = { eslint },
|
||||
-- typescriptreact = { eslint },
|
||||
-- javascript = { eslint },
|
||||
-- javascriptreact = { eslint },
|
||||
-- sh = { shellcheck },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- rust_analyzer = {
|
||||
-- assist = {
|
||||
-- importGranularity = "module",
|
||||
-- importPrefix = "self",
|
||||
-- },
|
||||
-- cargo = {
|
||||
-- buildScripts = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- },
|
||||
-- procMacro = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- },
|
||||
-- gleam = {},
|
||||
-- denols = {
|
||||
-- root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
|
||||
-- },
|
||||
-- zls = {},
|
||||
-- bashls = {},
|
||||
-- }
|
||||
-- end
|
||||
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "folke/neodev.nvim", },
|
||||
config = config,
|
||||
config = function()
|
||||
require("neodev").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
|
|
|
|||
Loading…
Reference in a new issue