144 lines
4 KiB
Nix
144 lines
4 KiB
Nix
{ ... }: {
|
|
imports = [ ./nixvim/base.nix ];
|
|
|
|
programs.nixvim = {
|
|
extraConfigLuaPost = ''
|
|
local _border = "rounded"
|
|
|
|
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 }
|
|
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
|
|
|
|
vim.diagnostic.config ( { virtual_text = { prefix = '●', } } )
|
|
vim.diagnostic.config { float = { border = _border } }
|
|
'';
|
|
|
|
plugins = {
|
|
lsp-lines.enable = false;
|
|
lsp-lines.currentLine = true;
|
|
crates-nvim.enable = true;
|
|
lspsaga = {
|
|
enable = false;
|
|
lightbulb.enable = false;
|
|
ui.border = "rounded";
|
|
};
|
|
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;
|
|
};
|
|
jedi_completion = {
|
|
enabled = true;
|
|
fuzzy = true;
|
|
};
|
|
pylint.enabled = true;
|
|
pylsp_mypy.enabled = true;
|
|
};
|
|
};
|
|
};
|
|
nil_ls.enable = true;
|
|
html.enable = true;
|
|
cssls.enable = true;
|
|
bashls.enable = true;
|
|
tailwindcss.enable = true;
|
|
svelte.enable = true;
|
|
};
|
|
|
|
onAttach = ''
|
|
vim.api.nvim_create_autocmd("CursorHold", {
|
|
buffer = bufnr,
|
|
callback = function()
|
|
local opts = {
|
|
focusable = false,
|
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
|
border = 'rounded',
|
|
source = 'always',
|
|
prefix = ' ',
|
|
scope = 'cursor',
|
|
}
|
|
vim.diagnostic.open_float(nil, opts)
|
|
end
|
|
})
|
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with (
|
|
vim.lsp.handlers.hover, {
|
|
border = "rounded",
|
|
}
|
|
)
|
|
'';
|
|
keymaps = {
|
|
silent = false;
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|