2024-11-19 16:41:16 +01:00

143 lines
4.0 KiB
Nix

{pkgs, ...}: {
plugins = {
lsp-lines.enable = true;
lsp-format.enable = true;
lsp = {
enable = true;
inlayHints = true;
servers = {
html.enable = true;
lua_ls.enable = true;
nixd.enable = true;
marksman.enable = true;
ansiblels.enable = true;
jsonls.enable = true;
solargraph.enable = true;
bashls.enable = true;
rust_analyzer = {
enable = true;
package = null;
installCargo = false;
installRustc = false;
extraOptions = {
check.command = "clippy";
};
};
yamlls = {
enable = true;
extraOptions = {
settings = {
yaml = {
schemas = {
kubernetes = ".h8s/*.{yml,yaml}";
"http://json.schemastore.org/github-workflow" = ".github/workflows/*";
"http://json.schemastore.org/github-action" = ".github/action.{yml,yaml}";
"http://json.schemastore.org/ansible-stable-2.9" = "roles/tasks/*.{yml,yaml}";
"http://json.schemastore.org/kustomization" = "kustomization.{yml,yaml}";
"http://json.schemastore.org/ansible-playbook" = "*play*.{yml,yaml}";
"http://json.schemastore.org/chart" = "Chart.{yml,yaml}";
"https://json.schemastore.org/dependabot-v2" = ".github/dependabot.{yml,yaml}";
"https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json" = "*docker-compose*.{yml,yaml}";
"https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json" = "*flow*.{yml,yaml}";
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json" = ".gitlab-ci.yml";
};
};
};
};
};
};
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
ga = {
action = "code_action";
desc = "Code Action";
};
ff = {
action = "format";
desc = "Format Code";
};
K = {
action = "hover";
desc = "Hover";
};
"<leader>cw" = {
action = "workspace_symbol";
desc = "Workspace Symbol";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
diagnostic = {
"<leader>cd" = {
action = "open_float";
desc = "Line Diagnostics";
};
"[d" = {
action = "goto_next";
desc = "Next Diagnostic";
};
"]d" = {
action = "goto_prev";
desc = "Previous Diagnostic";
};
};
};
};
};
extraPlugins = with pkgs.vimPlugins; [
ansible-vim
];
extraConfigLua =
/*
lua
*/
''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
};
require('lspconfig.ui.windows').default_options = {
border = _border
}
'';
}