feat:add_nixvim

This commit is contained in:
dichgrem
2025-09-21 15:54:31 +08:00
parent c36f91562d
commit 8016a1173d
64 changed files with 3608 additions and 30 deletions

View File

@@ -0,0 +1,46 @@
{
pkgs,
lib,
...
}: {
plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {
lspFallback = true;
timeoutMs = 500;
};
formatters_by_ft = {
# Use the "_" filetype to run formatters on filetypes that don't have other formatters configured.
"_" = [
"squeeze_blanks"
"trim_whitespace"
"trim_newlines"
];
};
formatters = {
_ = {
command = "${pkgs.gawk}/bin/gawk";
};
squeeze_blanks = {
command = lib.getExe' pkgs.coreutils "cat";
};
};
};
};
keymaps = [
{
mode = [
"n"
"v"
];
key = "<leader>cf";
action = "<cmd>lua require('conform').format()<cr>";
options = {
silent = true;
desc = "Format";
};
}
];
}

View File

@@ -0,0 +1,91 @@
{lib, ...}: {
plugins.fidget = {
enable = true;
settings = {
logger = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
float_precision = 0.01; # Limit the number of decimals displayed for floats
};
notification = {
poll_rate = 10; # How frequently to update and render notifications
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
history_size = 128; # Number of removed messages to retain in history
override_vim_notify = true;
window = {
normal_hl = "Comment";
winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45;
max_width = 0;
max_height = 0;
x_padding = 1;
y_padding = 0;
align = "bottom";
relative = "editor";
};
view = {
stack_upwards = true; # Display notification items from bottom to top
icon_separator = " "; # Separator between group name and icon
group_separator = "---"; # Separator between notification groups
group_separator_hl =
# Highlight group used for group separator
"Comment";
};
};
progress = {
poll_rate = 0; # How and when to poll for progress messages
suppress_on_insert = true; # Suppress new messages while in insert mode
ignore_done_already = false; # Ignore new tasks that are already complete
ignore_empty_message = false; # Ignore new tasks that don't contain a message
clear_on_detach =
# Clear notification group when LSP server detaches
''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
'';
notification_group =
# How to get a progress message's notification group key
''
function(msg) return msg.lsp_client.name end
'';
ignore = []; # List of LSP servers to ignore
lsp = {
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
};
display = {
render_limit = 16; # How many LSP messages to show at once
done_ttl = 3; # How long a message should persist after completion
done_icon = ""; # Icon shown when all LSP progress tasks are complete
done_style = "Constant"; # Highlight group for completed LSP tasks
progress_ttl = lib.nixvim.mkRaw "math.huge"; # How long a message should persist when in progress
progress_icon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
group_style = "Title"; # Highlight group for group name (LSP server name)
icon_style = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skip_history = true; # Whether progress notifications should be omitted from history
format_message = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
format_annote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
format_group_name = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
};
};
}

View File

@@ -0,0 +1,24 @@
{
plugins = {
lsp-signature.enable = true;
lsp = {
enable = true;
servers.typos_lsp.enable = true;
keymaps.lspBuf = {
"<c-k>" = "signature_help";
"gi" = "implementation";
};
};
lint.enable = true;
};
keymaps = [
{
mode = "n";
key = "<leader>cl";
action = "<cmd>LspInfo<cr>";
options.desc = "Lsp Info";
}
];
}

View File

@@ -0,0 +1,184 @@
{
plugins = {
lspsaga = {
enable = true;
settings = {
beacon.enable = true;
outline = {
close_after_jump = true;
layout = "normal"; # normal or float
win_position = "right"; # left or right
keys = {
jump = "e";
quit = "q";
toggle_or_jump = "o";
};
};
symbol_in_winbar = {
enable = true; # Breadcrumbs
show_file = false;
};
rename.keys = {
exec = "<CR>";
quit = [
"<C-k>"
"<Esc>"
];
select = "x";
};
scroll_preview = {
scroll_up = "<C-d>";
scroll_down = "<C-u>";
};
lightbulb = {
enable = true;
sign = true;
};
code_action = {
show_server_name = true;
num_shortcut = false;
only_in_cursor = false;
keys = {
exec = "<CR>";
quit = [
"<Esc>"
"q"
];
};
};
ui.border = "rounded"; # One of none, single, double, rounded, solid, shadow
hover = {
openCmd = "!firfox";
openLink = "gx";
};
};
};
which-key.settings.spec = [
{
__unkeyed-1 = "gp";
mode = "n";
group = "+peek";
}
];
};
keymaps = [
{
mode = "n";
key = "K";
# action = "<cmd>Lspsaga hover_doc<CR>";
action.__raw = ''
function()
local winid = require("ufo").peekFoldedLinesUnderCursor()
if not winid then
vim.cmd("Lspsaga hover_doc")
end
end
'';
options = {
desc = "Hover";
silent = true;
};
}
{
mode = "n";
key = "<leader>lo";
action = "<cmd>Lspsaga outline<CR>";
options = {
desc = "Outline";
silent = true;
};
}
{
mode = "n";
key = "<leader>lr";
action = "<cmd>Lspsaga rename<CR>";
options = {
desc = "Rename";
silent = true;
};
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>Lspsaga code_action<CR>";
options = {
desc = "Code Action";
silent = true;
};
}
{
mode = "n";
key = "<leader>cd";
action = "<cmd>Lspsaga show_buf_diagnostics<CR>";
options = {
desc = "Line Diagnostics";
silent = true;
};
}
{
mode = "n";
key = "gd";
action = "<cmd>Lspsaga goto_definition<CR>";
options = {
desc = "Goto Definition";
silent = true;
};
}
{
mode = "n";
key = "gt";
action = "<cmd>Lspsaga goto_type_definition<CR>";
options = {
desc = "Type Definitions";
silent = true;
};
}
{
mode = "n";
key = "gpd";
action = "<cmd>Lspsaga peek_definition<CR>";
options = {
desc = "Peek Definitions";
silent = true;
};
}
{
mode = "n";
key = "gpt";
action = "<cmd>Lspsaga peek_type_definition<CR>";
options = {
desc = "Peek Type Definitions";
silent = true;
};
}
{
mode = "n";
key = "gl";
action = "<cmd>Lspsaga show_line_diagnostics<CR>";
options = {
desc = "Line Diagnostics";
silent = true;
};
}
{
mode = "n";
key = "[d";
action = "<cmd>Lspsaga diagnostic_jump_next<CR>";
options = {
desc = "Next Diagnostic";
silent = true;
};
}
{
mode = "n";
key = "]d";
action = "<cmd>Lspsaga diagnostic_jump_prev<CR>";
options = {
desc = "Previous Diagnostic";
silent = true;
};
}
];
}

View File

@@ -0,0 +1,50 @@
{
plugins.trouble = {
enable = true;
settings.auto_close = true;
};
keymaps = [
{
mode = "n";
key = "<leader>x";
action = "+diagnostics/quickfix";
}
{
mode = "n";
key = "<leader>xx";
action = "<cmd>TroubleToggle<cr>";
options = {
silent = true;
desc = "Document Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xX";
action = "<cmd>TroubleToggle workspace_diagnostics<cr>";
options = {
silent = true;
desc = "Workspace Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xt";
action = "<cmd>TroubleToggle todo<cr>";
options = {
silent = true;
desc = "Todo (Trouble)";
};
}
{
mode = "n";
key = "<leader>xq";
action = "<cmd>TodoQuickFix<cr>";
options = {
silent = true;
desc = "Quickfix List (Trouble)";
};
}
];
}