mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 10:59:49 +01:00
feat: add trouble keybindings
This commit is contained in:
parent
46c602f74d
commit
351803ace0
2 changed files with 24 additions and 15 deletions
|
@ -6,18 +6,23 @@
|
||||||
with lib;
|
with lib;
|
||||||
with builtins; let
|
with builtins; let
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
self = import ./trouble.nix {inherit lib;};
|
||||||
|
|
||||||
|
mappingDefinitions = self.options.vim.lsp.trouble.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||||
vim.startPlugins = ["trouble"];
|
vim.startPlugins = ["trouble"];
|
||||||
|
|
||||||
vim.maps.normal = {
|
vim.maps.normal = mkMerge [
|
||||||
"<leader>xx" = {action = "<cmd>TroubleToggle<CR>";};
|
(mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||||
"<leader>lwd" = {action = "<cmd>TroubleToggle workspace_diagnostics<CR>";};
|
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||||
"<leader>ld" = {action = "<cmd>TroubleToggle document_diagnostics<CR>";};
|
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||||
"<leader>lr" = {action = "<cmd>TroubleToggle lsp_references<CR>";};
|
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||||
"<leader>xq" = {action = "<cmd>TroubleToggle quickfix<CR>";};
|
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||||
"<leader>xl" = {action = "<cmd>TroubleToggle loclist<CR>";};
|
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||||
};
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''
|
||||||
-- Enable trouble diagnostics viewer
|
-- Enable trouble diagnostics viewer
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
{
|
{lib, ...}:
|
||||||
config,
|
with lib; {
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
with builtins; {
|
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
trouble = {
|
trouble = {
|
||||||
enable = mkEnableOption "Enable trouble diagnostics viewer";
|
enable = mkEnableOption "Enable trouble diagnostics viewer";
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
||||||
|
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||||
|
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
||||||
|
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
||||||
|
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
||||||
|
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue