config-perso/kat/users/neovim/default.nix
2024-11-08 09:02:32 +01:00

117 lines
2.6 KiB
Nix

{
config,
lib,
...
}:
with lib;
{
options.kat.neovim = {
enable = mkEnableOption "neovim configuration" // {
default = true;
};
lsp = mkEnableOption "neovim LSPs";
};
config = mkIf config.kat.neovim.enable {
programs.nixvim = {
enable = true;
defaultEditor = true;
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
'';
};
};
opts = {
foldlevelstart = 99;
number = true;
relativenumber = true;
cursorline = true;
tabstop = 2;
shiftwidth = 2;
expandtab = true;
};
autoCmd = [
{
command = "set relativenumber";
event = [ "InsertLeave" ];
}
{
command = "set norelativenumber";
event = [ "InsertEnter" ];
}
];
keymaps = [
{
action = ":set number!<CR>";
key = "<F2>";
}
{
action = ":set relativenumber!<CR>";
key = "<F3>";
}
{
action = ''"*ygv'';
key = "<LeftRelease>";
mode = [ "v" ];
}
];
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;
lsp = mkIf config.kat.neovim.lsp {
enable = true;
servers = {
nixd.enable = true;
pylsp.enable = true;
clangd.enable = true;
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
};
};
};
};
};
}