mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 09:49:48 +01:00
feat: apply new module format to lsp plugins
This commit is contained in:
parent
e09ccfd014
commit
067b523897
18 changed files with 175 additions and 31 deletions
|
@ -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
|
||||
];
|
||||
}
|
||||
|
|
|
@ -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"];
|
||||
|
6
modules/lsp/lightbulb/default.nix
Normal file
6
modules/lsp/lightbulb/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./lightbulb.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/lsp/lightbulb/lightbulb.nix
Normal file
16
modules/lsp/lightbulb/lightbulb.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
6
modules/lsp/lsp-signature/default.nix
Normal file
6
modules/lsp/lsp-signature/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./lsp-signature.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/lsp/lsp-signature/lsp-signature.nix
Normal file
16
modules/lsp/lsp-signature/lsp-signature.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
52
modules/lsp/lspsaga/config.nix
Normal file
52
modules/lsp/lspsaga/config.nix
Normal 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()
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/lsp/lspsaga/default.nix
Normal file
6
modules/lsp/lspsaga/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./lspsaga.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/lsp/module.nix
Normal file
16
modules/lsp/module.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
/*
|
||||
...
|
||||
*/
|
||||
};
|
||||
}
|
|
@ -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"];
|
||||
|
6
modules/lsp/nvim-code-action-menu/default.nix
Normal file
6
modules/lsp/nvim-code-action-menu/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./nvim-code-action-menu.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix
Normal file
16
modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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"];
|
||||
|
6
modules/lsp/trouble/default.nix
Normal file
6
modules/lsp/trouble/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./trouble.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
16
modules/lsp/trouble/trouble.nix
Normal file
16
modules/lsp/trouble/trouble.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue