Skip to content

beauwilliams/hover.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

WIP

hover.nvim

General framework for context aware hover providers (similar to vim.lsp.buf.hover).

Screenshots

LSP Github Issues
Dictionary

Setup and Installation

via packer:

use {
    "lewis6991/hover.nvim",
    config = function()
        require("hover").setup {
            init = function()
                -- Require providers
                require("hover.providers.lsp")
                -- require('hover.providers.gh')
                -- require('hover.providers.man')
                -- require('hover.providers.dictionary')
            end,
            preview_opts = {
                border = nil
            },
            title = true
        }

        -- Setup keymaps
        vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
        vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
    end
}

Built in Providers

LSP

require('hover.providers.lsp')

Builtin LSP

Priority: 1000

Github

require('hover.providers.gh')

Opens issue/PR's for symbols like #123.

Requires the gh command.

Priority: 200

Man

require('hover.providers.man')

man entries

Priority: 150

Dictionary

require('hover.providers.dictionary')

Definitions for valid words

Priority: 100

Creating a hover provider

Call require('hover').register(<provider>) with a table containing the following fields:

  • name: string, name of the hover provider
  • enabled: function, whether the hover is active for the current context
  • execute: function, executes the hover. Has the following arguments:
    • done: callback. First argument should be passed:
      • nil/false if the hover failed to execute. This will allow other lower priority hovers to run.
      • A table with the following fields:
        • lines (string array)
        • filetype (string)
  • priority: number (optional), priority of the provider

Example:

-- Simple
require('hover').register {
   name = 'Simple',
   enabled = function()
     return true
   end,
   execute = function(done)
     done{lines={'TEST'}, filetype="markdown"}
   end
}

About

Hover plugin framework for Neovim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%