Coder Social home page Coder Social logo

hover.nvim's Introduction

hover.nvim

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

Screenshots

LSP Github Issues
Dictionary Github User

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.gh_user')
                -- require('hover.providers.jira')
                -- require('hover.providers.man')
                -- require('hover.providers.dictionary')
            end,
            preview_opts = {
                border = nil
            },
            -- Whether the contents of a currently open hover window should be moved
            -- to a :h preview-window when pressing the hover keymap.
            preview_window = false,
            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: Issues and PR's

require('hover.providers.gh')

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

Requires the gh command.

Priority: 200

Github: Users

require('hover.providers.gh_user')

Information for github users in TODO comments. Matches TODO(<user>) and TODO(@<user>).

Requires the gh command.

Priority: 200

Jira

require('hover.providers.jira')

Opens issue for symbols like ABC-123.

Requires the jira command.

Priority: 175

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)
        • bufnr (integer?) use a pre-populated buffer for the hover window. Ignores lines.
  • 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
}

hover.nvim's People

Contributors

b0o avatar beauwilliams avatar flrgh avatar halftan avatar laytan avatar lewis6991 avatar wangl-cc avatar williamboman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.