Compare commits
No commits in common. "cad28aae41ea58a0c3e42c77f27f6681f7ab7594" and "e528c11fab141187565619c422cee58693647ef0" have entirely different histories.
cad28aae41
...
e528c11fab
5 changed files with 144 additions and 142 deletions
1
home.nix
1
home.nix
|
|
@ -42,7 +42,6 @@ in
|
|||
devenv
|
||||
devbox
|
||||
tldr
|
||||
biome
|
||||
];
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ 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", {}),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "3a274c38e53800cf1d72b79baeb6c73e03ef1db3" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "cc2f5f2fa28d240574808e78847978ed6ef20d2a" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "de003000a287c501a6650a1ddd3be80ee34278d4" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
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,79 +1,154 @@
|
|||
-- local function config()
|
||||
-- local lspconfig = require "lspconfig"
|
||||
local function config()
|
||||
local lspconfig = require "lspconfig"
|
||||
require "neodev".setup()
|
||||
|
||||
-- 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 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 has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if has_cmp then
|
||||
capabilities = cmp_lsp.default_capabilities()
|
||||
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
|
||||
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
|
||||
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "folke/neodev.nvim", },
|
||||
config = function()
|
||||
require("neodev").setup()
|
||||
end,
|
||||
config = config,
|
||||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
|
|
|
|||
Loading…
Reference in a new issue