mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-24 14:16:46 +00:00
99ace503ad
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* plugins/lsp: add code-actions module; add fastaction.nvim * deprecate nvimCodeActionMenu * fastaction-nvim: move range_code_action to visual maps * fastaction: move to vim.ui, remove mappings, enable register_ui_select by default * fastaction: add missing documentation * fastaction: support vim.ui.borders * treewide: clean up nvim-code-action-menu remnants * docs: add missing section ids --------- Co-authored-by: NotAShelf <raf@notashelf.dev>
54 lines
2.2 KiB
Nix
54 lines
2.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
inherit (lib.strings) optionalString;
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
|
|
|
cfg = config.vim.lsp;
|
|
self = import ./lspsaga.nix {inherit lib;};
|
|
|
|
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
|
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
|
in {
|
|
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
|
vim = {
|
|
startPlugins = ["lspsaga"];
|
|
|
|
maps = {
|
|
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
|
normal = mkMerge [
|
|
(mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder")
|
|
(mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc")
|
|
|
|
(mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end")
|
|
(mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end")
|
|
|
|
(mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename")
|
|
(mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition")
|
|
|
|
(mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics")
|
|
(mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics")
|
|
|
|
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
|
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
|
|
|
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
|
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
|
];
|
|
};
|
|
|
|
pluginRC.lspsaga = entryAnywhere ''
|
|
require('lspsaga').init_lsp_saga({
|
|
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
|
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
|
''}
|
|
})
|
|
'';
|
|
};
|
|
};
|
|
}
|