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
zsh = import ./zsh.nix;
in
@ -15,7 +15,10 @@ in
# ssh = mkEnableOption "ssh configuration";
# };
config = {
home.stateVersion = config.system.stateVersion;
home = {
stateVersion = config.system.stateVersion;
packages = [ pkgs.rlwrap ];
};
};
}
];

View file

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