Something went wrong. Try again.
forked from nix-community/nixvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ lib, config, ... }:let keymapType = lib.nixvim.keymaps.mkMapOptionSubmodule { action = false; }; hoverKeymap = { description, exampleKey }: lib.mkOption { type = lib.types.nullOr keymapType; default = null; inherit description; example = { key = exampleKey; mode = "n"; }; }; hoverKeymapEntry = { action, function ? "${action}()", }: let mapping = config.plugins.hover.keymaps.${action}; in lib.mkIf (mapping != null) ( lib.mkMerge [ (mapping // { options = lib.filterAttrs (_: value: value != null) mapping.options; }) { action = lib.nixvim.mkRaw /* lua */ '' function() require('hover').${function} end ''; options.desc = lib.mkDefault "hover.nvim (${function})"; } ] );inlib.nixvim.plugins.mkNeovimPlugin { name = "hover"; package = "hover-nvim"; setup = ".config";
description = /* markdown */ '' General framework for context aware hover providers (similar to vim.lsp.buf.hover). You should also create keybinds for: - `require("hover").open()` - `require("hover").enter()` - `require("hover").switch()` - `require("hover").switch("previous")` - `require("hover").switch("next")`
Also, create a bind from `<MouseMove>` to `require("hover").mouse()` and set `opts.mousemoveevent = true`. '';
maintainers = [ lib.maintainers.libewa ];
settingsExample = { providers = [ "hover.providers.diagnostic" "hover.providers.lsp" "hover.providers.dap" "hover.providers.man" "hover.providers.dictionary" ]; preview_opts.border = "single"; preview_window = false; title = true; mouse_providers = [ "hover.providers.lsp" ]; mouse_delay = 1000; }; extraOptions = { keymaps = { open = hoverKeymap { description = "A keymap to open the hover window."; exampleKey = "K"; }; enter = hoverKeymap { description = "A keymap to enter the hover window for scrolling."; exampleKey = "gK"; }; previous = hoverKeymap { description = "A keymap to switch to the previous Hover provider."; exampleKey = "<C-p>"; }; next = hoverKeymap { description = "A keymap to switch to the next Hover provider."; exampleKey = "<C-n>"; }; }; enableMouse = lib.mkEnableOption "mouse hover support"; }; extraConfig = { keymaps = [ (hoverKeymapEntry { action = "open"; }) (hoverKeymapEntry { action = "enter"; }) (hoverKeymapEntry { action = "previous"; function = "switch('previous')"; }) (hoverKeymapEntry { action = "next"; function = "switch('next')"; }) (lib.mkIf config.plugins.hover.enableMouse { key = "<MouseMove>"; action = lib.nixvim.mkRaw "function() require('hover').mouse() end"; options.remap = true; options.desc = "hover.nvim (mouse)"; }) ]; opts = lib.mkIf config.plugins.hover.enableMouse { mousemoveevent = true; }; };}