nix/home-manager/common/software/cli/nixvim.nix

129 lines
3.5 KiB
Nix
Raw Normal View History

2024-04-05 09:39:12 +09:00
{ ... }: {
imports = [ ./nixvim/base.nix ];
2024-02-08 11:17:11 +09:00
2024-02-16 17:56:55 +09:00
programs.nixvim = {
2024-04-03 08:28:13 +09:00
extraConfigLuaPost = ''
local _border = "rounded"
2024-04-03 16:27:54 +09:00
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with (
2024-04-03 08:28:13 +09:00
vim.lsp.handlers.signature_help, {
border = _border
}
)
require('lspconfig.ui.windows').default_options = { border = _border }
local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
2024-04-03 16:27:54 +09:00
vim.diagnostic.config ( { virtual_text = { prefix = '', } } )
vim.diagnostic.config { float = { border = _border } }
2024-04-03 22:12:09 +09:00
vim.diagnostic.config({ virtual_text = false })
2024-04-03 08:28:13 +09:00
'';
2024-02-16 17:56:55 +09:00
plugins = {
2024-04-03 20:07:58 +09:00
lsp-lines.enable = true;
2024-04-03 22:12:09 +09:00
lsp-lines.currentLine = true;
2024-03-30 15:27:21 +09:00
crates-nvim.enable = true;
2024-04-03 16:27:54 +09:00
lspsaga = {
enable = false;
lightbulb.enable = false;
ui.border = "rounded";
};
2024-02-16 17:56:55 +09:00
lsp = {
enable = true;
servers = {
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
pylsp = {
enable = true;
autostart = true;
installLanguageServer = true;
settings = {
plugins = {
black = {
enabled = true;
preview = true;
2024-02-08 11:42:16 +09:00
};
2024-02-16 17:56:55 +09:00
jedi_completion = {
enabled = true;
fuzzy = true;
2024-02-13 14:19:41 +09:00
};
2024-02-16 17:56:55 +09:00
pylint.enabled = true;
2024-02-16 18:56:48 +09:00
pylsp_mypy.enabled = true;
2024-02-16 17:56:55 +09:00
};
};
};
nil_ls.enable = true;
html.enable = true;
cssls.enable = true;
bashls.enable = true;
2024-04-02 11:19:43 +09:00
tailwindcss.enable = true;
svelte.enable = true;
2024-02-16 17:56:55 +09:00
};
2024-04-03 08:28:13 +09:00
onAttach = ''
2024-04-03 16:27:54 +09:00
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with (
vim.lsp.handlers.hover, {
border = "rounded",
}
)
2024-04-03 08:28:13 +09:00
'';
2024-04-03 22:12:09 +09:00
2024-02-16 17:56:55 +09:00
keymaps = {
2024-04-03 20:07:58 +09:00
silent = true;
2024-02-16 17:56:55 +09:00
diagnostic = {
"<leader>lk" = {
action = "goto_prev";
desc = "Go to prev";
};
"<leader>lj" = {
action = "goto_next";
desc = "Go to next";
};
};
lspBuf = {
K = {
action = "hover";
desc = "Hover";
};
"<leader>lr" = {
action = "references";
desc = "LSP [r]eferences";
};
"<leader>ld" = {
action = "definition";
desc = "LSP [d]efinitions";
};
"<leader>li" = {
action = "implementation";
desc = "LSP [i]implementations";
};
"<leader>lt" = {
action = "type_definition";
desc = "LSP [t]ype definitions";
};
"<leader>la" = {
action = "code_action";
desc = "LSP Code [A]ctions";
2024-02-08 11:42:16 +09:00
};
2024-02-16 17:56:55 +09:00
};
2024-02-08 11:17:11 +09:00
};
2024-02-16 17:56:55 +09:00
};
2024-02-08 11:17:11 +09:00
};
2024-02-16 17:56:55 +09:00
};
2024-02-08 19:08:43 +09:00
}