mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00: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 builtins; let
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
self = import ./trouble.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.lsp.trouble.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||
vim.startPlugins = ["trouble"];
|
||||
|
||||
vim.maps.normal = {
|
||||
"<leader>xx" = {action = "<cmd>TroubleToggle<CR>";};
|
||||
"<leader>lwd" = {action = "<cmd>TroubleToggle workspace_diagnostics<CR>";};
|
||||
"<leader>ld" = {action = "<cmd>TroubleToggle document_diagnostics<CR>";};
|
||||
"<leader>lr" = {action = "<cmd>TroubleToggle lsp_references<CR>";};
|
||||
"<leader>xq" = {action = "<cmd>TroubleToggle quickfix<CR>";};
|
||||
"<leader>xl" = {action = "<cmd>TroubleToggle loclist<CR>";};
|
||||
};
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''
|
||||
-- Enable trouble diagnostics viewer
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
{lib, ...}:
|
||||
with lib; {
|
||||
options.vim.lsp = {
|
||||
trouble = {
|
||||
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