feat: apply new module format to lsp plugins

This commit is contained in:
NotAShelf 2023-02-27 22:25:39 +03:00
parent e09ccfd014
commit 067b523897
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
18 changed files with 175 additions and 31 deletions

View file

@ -5,11 +5,15 @@
...
}: {
imports = [
./lsp.nix
./lspsaga.nix
./nvim-code-action-menu.nix
./trouble.nix
./lsp-signature.nix
./lightbulb.nix
# nvim lsp support
./config.nix
./module.nix
# lsp plugins
./lspsaga
./nvim-code-action-menu
./trouble
./lsp-signature
./lightbulb
];
}

View file

@ -8,12 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
lightbulb = {
enable = mkEnableOption "lightbulb for code actions. Requires emoji font";
};
};
config = mkIf (cfg.enable && cfg.lightbulb.enable) {
vim.startPlugins = ["nvim-lightbulb"];

View file

@ -0,0 +1,6 @@
_: {
imports = [
./lightbulb.nix
./config.nix
];
}

View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
lightbulb = {
enable = mkEnableOption "lightbulb for code actions. Requires emoji font";
};
};
}

View file

@ -8,14 +8,10 @@ with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
lspSignature = {
enable = mkEnableOption "lsp signature viewer";
};
};
config = mkIf (cfg.enable && cfg.lspSignature.enable) {
vim.startPlugins = ["lsp-signature"];
vim.startPlugins = [
"lsp-signature"
];
vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere ''
-- Enable lsp signature viewer

View file

@ -0,0 +1,6 @@
_: {
imports = [
./lsp-signature.nix
./config.nix
];
}

View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
lspSignature = {
enable = mkEnableOption "lsp signature viewer";
};
};
}

View file

@ -0,0 +1,52 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
vim.startPlugins = ["lspsaga"];
vim.vnoremap = {
"<silent><leader>ca" = ":<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>";
};
vim.nnoremap =
{
"<silent><leader>lf" = "<cmd>lua require'lspsaga.provider'.lsp_finder()<CR>";
"<silent><leader>lh" = "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>";
"<silent><C-f>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>";
"<silent><C-b>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>";
"<silent><leader>lr" = "<cmd>lua require'lspsaga.rename'.rename()<CR>";
"<silent><leader>ld" = "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>";
"<silent><leader>ll" = "<cmd>lua require'lspsaga.diagnostic'.show_line_diagnostics()<CR>";
"<silent><leader>lc" = "<cmd>lua require'lspsaga.diagnostic'.show_cursor_diagnostics()<CR>";
"<silent><leader>lp" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_prev()<CR>";
"<silent><leader>ln" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_next()<CR>";
}
// (
if (!cfg.nvimCodeActionMenu.enable)
then {
"<silent><leader>ca" = "<cmd>lua require('lspsaga.codeaction').code_action()<CR>";
}
else {}
)
// (
if (!cfg.lspSignature.enable)
then {
"<silent><leader>ls" = "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>";
}
else {}
);
vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere ''
-- Enable lspsaga
local saga = require 'lspsaga'
saga.init_lsp_saga()
'';
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./lspsaga.nix
./config.nix
];
}

16
modules/lsp/module.nix Normal file
View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
/*
...
*/
};
}

View file

@ -8,12 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
nvimCodeActionMenu = {
enable = mkEnableOption "nvim code action menu";
};
};
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
vim.startPlugins = ["nvim-code-action-menu"];

View file

@ -0,0 +1,6 @@
_: {
imports = [
./nvim-code-action-menu.nix
./config.nix
];
}

View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
nvimCodeActionMenu = {
enable = mkEnableOption "nvim code action menu";
};
};
}

View file

@ -8,12 +8,6 @@ with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
trouble = {
enable = mkEnableOption "trouble diagnostics viewer";
};
};
config = mkIf (cfg.enable && cfg.trouble.enable) {
vim.startPlugins = ["trouble"];

View file

@ -0,0 +1,6 @@
_: {
imports = [
./trouble.nix
./config.nix
];
}

View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
options.vim.lsp = {
trouble = {
enable = mkEnableOption "trouble diagnostics viewer";
};
};
}