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,15 +4,8 @@
... ...
}: }:
with lib; with lib;
{ let
options.kat.neovim = { basecfg = {
enable = mkEnableOption "neovim configuration" // {
default = true;
};
lsp = mkEnableOption "neovim LSPs";
};
config = mkIf config.kat.neovim.enable {
programs.nixvim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
vimdiffAlias = true; vimdiffAlias = true;
@ -46,6 +39,7 @@ with lib;
shiftwidth = 2; shiftwidth = 2;
expandtab = true; expandtab = true;
}; };
globals.mapleader = ",";
autoCmd = [ autoCmd = [
{ {
@ -98,7 +92,75 @@ with lib;
web-devicons.enable = true; web-devicons.enable = true;
lsp = mkIf config.kat.neovim.lsp { 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; enable = true;
keymaps = { keymaps = {
diagnostic = { diagnostic = {
@ -106,26 +168,26 @@ with lib;
"lk" = "goto_prev"; "lk" = "goto_prev";
}; };
lspBuf = { lspBuf = {
K = "hover"; "<leader>lK" = "hover";
lgD = "references"; "<leader>la" = "code_action";
lgd = "definition"; "<leader>ls" = "signature_help";
lgi = "implementation"; "<leader>lgD" = "references";
lgt = "type_definition"; "<leader>lgd" = "definition";
la = "code_action"; "<leader>lgi" = "implementation";
ls = "signature_help"; "<leader>lgt" = "type_definition";
}; };
extra = [ extra = [
{ {
action = "<CMD>LspStop<Enter>"; action = "<CMD>LspStop<Enter>";
key = "lx"; key = "<leader>lx";
} }
{ {
action = "<CMD>LspStart<Enter>"; action = "<CMD>LspStart<Enter>";
key = "ls"; key = "<leader>ls";
} }
{ {
action = "<CMD>LspRestart<Enter>"; action = "<CMD>LspRestart<Enter>";
key = "lr"; key = "<leader>lr";
} }
]; ];
}; };
@ -143,5 +205,18 @@ with lib;
}; };
}; };
}; };
in
{
options.kat.neovim = {
enable = mkEnableOption "neovim configuration" // {
default = true;
};
lsp = mkEnableOption "neovim LSPs";
};
config = mkIf config.kat.neovim.enable {
programs.nixvim = mkMerge [
basecfg
(mkIf config.kat.neovim.lsp adv-editor)
];
}; };
} }