feat(neovim): some more plugins

This commit is contained in:
catvayor 2024-11-16 22:03:25 +01:00
parent b088049c45
commit 6ddf07aa20
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
2 changed files with 211 additions and 133 deletions

View file

@ -1,4 +1,4 @@
{ config, sources, ... }: { config, sources, pkgs, ... }:
let let
zsh = import ./zsh.nix; zsh = import ./zsh.nix;
in in
@ -15,7 +15,10 @@ in
# ssh = mkEnableOption "ssh configuration"; # ssh = mkEnableOption "ssh configuration";
# }; # };
config = { config = {
home.stateVersion = config.system.stateVersion; home = {
stateVersion = config.system.stateVersion;
packages = [ pkgs.rlwrap ];
};
}; };
} }
]; ];

View file

@ -4,6 +4,208 @@
... ...
}: }:
with lib; with lib;
let
basecfg = {
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;
};
globals.mapleader = ",";
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;
which-key = {
enable = true;
settings.triggers =
[
{
__unkeyed-1 = "<leader>";
mode = "nxsot";
}
{
__unkeyed-1 = "f";
mode = "nxsot";
}
];
};
todo-comments = {
enable = true;
keymaps.todoTelescope.key = "ft";
};
markview.enable = true;
nvim-surround.enable = true;
};
};
adv-editor = {
plugins = {
which-key.settings.spec = [
{
__unkeyed = "<leader>l";
desc = "Lsp keymaps";
}
{
__unkeyed = "<leader>lK";
desc = "Hover information";
}
{
__unkeyed = "<leader>la";
desc = "Apply code action";
}
{
__unkeyed = "<leader>ls";
desc = "Show signature help";
}
{
__unkeyed = "<leader>lg";
desc = "Go to";
}
{
__unkeyed = "<leader>lgD";
desc = "References";
}
{
__unkeyed = "<leader>lgd";
desc = "Definition";
}
{
__unkeyed = "<leader>lgi";
desc = "Implementation";
}
{
__unkeyed = "<leader>lgt";
desc = "Type definition";
}
];
lsp-lines.enable = true;
lsp = {
enable = true;
keymaps = {
diagnostic = {
"lj" = "goto_next";
"lk" = "goto_prev";
};
lspBuf = {
"<leader>lK" = "hover";
"<leader>la" = "code_action";
"<leader>ls" = "signature_help";
"<leader>lgD" = "references";
"<leader>lgd" = "definition";
"<leader>lgi" = "implementation";
"<leader>lgt" = "type_definition";
};
extra = [
{
action = "<CMD>LspStop<Enter>";
key = "<leader>lx";
}
{
action = "<CMD>LspStart<Enter>";
key = "<leader>ls";
}
{
action = "<CMD>LspRestart<Enter>";
key = "<leader>lr";
}
];
};
servers = {
nixd.enable = true;
pylsp.enable = true;
clangd.enable = true;
ltex.enable = true;
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
};
};
};
};
in
{ {
options.kat.neovim = { options.kat.neovim = {
enable = mkEnableOption "neovim configuration" // { enable = mkEnableOption "neovim configuration" // {
@ -12,136 +214,9 @@ with lib;
lsp = mkEnableOption "neovim LSPs"; lsp = mkEnableOption "neovim LSPs";
}; };
config = mkIf config.kat.neovim.enable { config = mkIf config.kat.neovim.enable {
programs.nixvim = { programs.nixvim = mkMerge [
enable = true; basecfg
defaultEditor = true; (mkIf config.kat.neovim.lsp adv-editor)
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;
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";
}
];
};
servers = {
nixd.enable = true;
pylsp.enable = true;
clangd.enable = true;
ltex.enable = true;
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
};
};
};
};
}; };
} }