https://github.com/beixiyo/vv-hover.nvim
Mouse-hover triggered LSP hover popup. 鼠标悬停自动 LSP Hover
https://github.com/beixiyo/vv-hover.nvim
hover lsp lua mouse neovim neovim-plugin nvim nvim-plugin
Last synced: 17 days ago
JSON representation
Mouse-hover triggered LSP hover popup. 鼠标悬停自动 LSP Hover
- Host: GitHub
- URL: https://github.com/beixiyo/vv-hover.nvim
- Owner: beixiyo
- License: mit
- Created: 2026-04-25T07:05:56.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-23T08:47:56.000Z (about 1 month ago)
- Last Synced: 2026-05-23T10:35:12.074Z (about 1 month ago)
- Topics: hover, lsp, lua, mouse, neovim, neovim-plugin, nvim, nvim-plugin
- Language: Lua
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
vv-hover.nvim
基于鼠标位置的自动 LSP Hover — 悬停即显文档,可扩展 Provider
---
## 安装
```lua
{
'beixiyo/vv-hover.nvim',
event = 'VeryLazy',
---@type HoverConfig
opts = {
enabled = true,
timing = {
hover_delay = 500, -- 鼠标停留触发延迟(ms)
close_delay = 300, -- 鼠标移开后延迟关闭(ms)
},
ui = {
border = 'rounded', -- 边框样式
max_width = 80,
max_height = 20,
focusable = true,
zindex = 150,
relative = 'mouse', -- 浮窗相对位置:'mouse' | 'cursor' | 'editor'
},
behavior = {
close_on_move = true, -- 鼠标移出符号位置时自动关闭
close_on_insert = false, -- 进入插入模式时关闭
only_normal_buf = true, -- 只在普通文件 buffer 中启用
},
},
}
```
## 配置
### 时序
| 选项 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `timing.hover_delay` | `integer` | `500` | 鼠标悬停多久后触发 hover(ms) |
| `timing.close_delay` | `integer` | `300` | 鼠标移开后延迟多久关闭浮窗(ms) |
### UI
| 选项 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `ui.border` | `string` | `'rounded'` | 浮窗边框样式 |
| `ui.max_width` | `integer` | `80` | 最大宽度 |
| `ui.max_height` | `integer` | `20` | 最大高度 |
| `ui.focusable` | `boolean` | `true` | 浮窗是否可聚焦 |
| `ui.zindex` | `integer` | `150` | 浮窗层级 |
| `ui.relative` | `string` | `'mouse'` | 浮窗定位基准:`'mouse'` / `'cursor'` / `'editor'` |
### 行为
| 选项 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `behavior.close_on_move` | `boolean` | `true` | 鼠标移出符号位置时自动关闭 |
| `behavior.close_on_insert` | `boolean` | `false` | 进入插入模式时关闭 |
| `behavior.only_normal_buf` | `boolean` | `true` | 只在普通文件 buffer 中启用(跳过 terminal / nofile 等) |
| `provider` | `HoverProvider?` | `nil` | 自定义内容提供者(`nil` 使用默认 LSP provider),也可通过 `set_provider()` 设置 |
### 自定义 Provider
默认使用 LSP hover。可通过 `set_provider` 替换为自定义内容源:
```lua
require('vv-hover').set_provider(function(ctx, callback)
-- ctx: { bufnr, winid, row, col, line_text, mouse_pos, lsp_clients }
callback({ lines = { '自定义内容' }, filetype = 'markdown' })
return true -- 异步 provider 返回 true
end)
```