/pretty_hover

Primary LanguageLuaMIT LicenseMIT

pretty_hover

Table of contents

Pretty_hover is a light weight plugin that parses the hover message before opening the popup window. The output can be easily manipulated with. This will result in more readable hover message.

How it looks

Using native vim.lsp.buf.hover()

Using pretty_hover

Installation and setup

via Lazy

{
	"Fildo7525/pretty_hover",
	event = "LspAttach",
	opts = {}
},

via Packer

use {
	"Fildo7525/pretty_hover",
	config = function()
		require("pretty_hover").setup(options)
	end
}

Using Pretty Hover

To open a hover window, run the following lua snippet (or bind it to a key)

require("pretty_hover").hover()

To close a hover window, run the following lua snippet (or bind it to a key)

require("pretty_hover").close()

NOTE: When focused on a hover window, you can also press q to close the hover window

Configuration

The configuration consists of four parts. line is a table containing all the words after which will the whole line surrounded by stylers.line character. The word will surround only one word after the elements with stylers.word character. The last table consists of flags that behave as an heading. The stylers.header will replace the elements in header. border is than passed to the nvim api and represents the type of the floating window.

NOTE: To really use this plugin you have to create a keymap that will call require('pretty_hover').hover() function.

Default configuration

{
	line = {
		"@brief",
	},
	word = {
		"@param",
		"@tparam",
		"@see",
	},
	header = {
		"@class",
	},
	stylers = {
		line = "**",
		word = "`",
		header = "###",
	},
	border = "rounded",
}

Inspiration

https://github.com/lewis6991/hover.nvim