config-perso/kat/users/neovim.nix

148 lines
3.4 KiB
Nix
Raw Normal View History

2024-09-26 11:51:04 +02:00
{
config,
lib,
...
}:
with lib;
{
2024-11-08 08:26:07 +01:00
options.kat.neovim = {
enable = mkEnableOption "neovim configuration" // {
default = true;
};
lsp = mkEnableOption "neovim LSPs";
2024-09-26 11:51:04 +02:00
};
2024-11-08 08:26:07 +01:00
config = mkIf config.kat.neovim.enable {
2024-11-01 15:11:35 +01:00
programs.nixvim = {
2024-09-26 11:51:04 +02:00
enable = true;
defaultEditor = true;
2024-11-01 15:11:35 +01:00
vimdiffAlias = true;
vimAlias = true;
viAlias = true;
colorschemes.dracula-nvim = {
enable = true;
settings = {
colors = {
bg = "#000000";
black = "#000000";
};
transparent_bg = true;
overrides.__raw = ''
function (colors) return {
LineNr = { bg = "#181818", fg = colors.purple },
CursorLine = { },
CursorLineNr = { fg = "#FFFF00", bg = colors.black, bold = true },
StatusLine = { fg = colors.bright_white, bg = colors.black },
} end
'';
};
};
2024-09-26 11:51:04 +02:00
2024-11-01 15:11:35 +01:00
opts = {
foldlevelstart = 99;
number = true;
relativenumber = true;
cursorline = true;
tabstop = 2;
shiftwidth = 2;
expandtab = true;
};
2024-09-26 11:51:04 +02:00
2024-11-01 15:11:35 +01:00
autoCmd = [
{
command = "set relativenumber";
event = [ "InsertLeave" ];
}
{
command = "set norelativenumber";
event = [ "InsertEnter" ];
}
2024-09-26 11:51:04 +02:00
];
2024-11-01 15:11:35 +01:00
keymaps = [
{
action = ":set number!<CR>";
key = "<F2>";
}
{
action = ":set relativenumber!<CR>";
key = "<F3>";
}
{
action = ''"*ygv'';
key = "<LeftRelease>";
mode = [ "v" ];
}
2024-09-26 11:51:04 +02:00
];
2024-11-01 15:11:35 +01:00
plugins = {
nix.enable = true;
treesitter = {
enable = true;
folding = true;
settings.highlight.enable = true;
};
telescope = {
enable = true;
keymaps = {
"ff".action = "find_files";
"fg".action = "live_grep";
"fb".action = "buffers";
};
settings.pickers.buffers.mappings = rec {
i."<c-d>".__raw = "require('telescope.actions').delete_buffer";
n = i;
};
};
web-devicons.enable = true;
2024-11-01 16:07:45 +01:00
2024-11-08 08:26:07 +01:00
lsp = mkIf config.kat.neovim.lsp {
2024-11-01 16:07:45 +01:00
enable = true;
2024-11-13 16:56:33 +01:00
keymaps = {
diagnostic = {
"lj" = "goto_next";
"lk" = "goto_prev";
};
lspBuf = {
K = "hover";
lgD = "references";
lgd = "definition";
lgi = "implementation";
lgt = "type_definition";
la = "code_action";
ls = "signature_help";
};
extra = [
{
action = "<CMD>LspStop<Enter>";
key = "lx";
}
{
action = "<CMD>LspStart<Enter>";
key = "ls";
}
{
action = "<CMD>LspRestart<Enter>";
key = "lr";
}
];
};
2024-11-01 16:07:45 +01:00
servers = {
nixd.enable = true;
pylsp.enable = true;
clangd.enable = true;
2024-11-13 16:56:33 +01:00
ltex.enable = true;
2024-11-01 16:07:45 +01:00
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
};
};
2024-11-01 15:11:35 +01:00
};
2024-09-26 11:51:04 +02:00
};
};
}