File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,4 @@ M.options = {
10
10
}
11
11
12
12
return M
13
- -- vim:ft=lua: ts=4:sts=4:noet:ai:si:sta:
13
+ -- vim:ts=4:sts=4:noet:ai:si:sta:
Original file line number Diff line number Diff line change 1
- local config = require (" hoversplit.config" )
2
-
3
1
local M = {}
4
2
3
+ local config = require (" hoversplit.config" )
4
+
5
5
M .hover_bufnr = nil --- @type integer | nil
6
6
M .hover_winid = nil --- @type integer | nil
7
7
M .orig_winid = nil --- @type integer | nil
@@ -49,6 +49,18 @@ function M.create_hover_split(vertical, remain_focused)
49
49
M .orig_winid = vim .api .nvim_get_current_win ()
50
50
M .hover_bufnr = vim .api .nvim_create_buf (false , true )
51
51
52
+ vim .api .nvim_create_autocmd (" BufEnter" , {
53
+ group = vim .api .nvim_create_augroup (" HoverSplitBuffer" , { clear = true }),
54
+ buffer = M .hover_bufnr ,
55
+ callback = function (ev )
56
+ vim .keymap .set (' n' , ' q' , M .close_hover_split , {
57
+ noremap = true ,
58
+ silent = true ,
59
+ buffer = ev .buf ,
60
+ })
61
+ end ,
62
+ })
63
+
52
64
if not vertical then
53
65
M .hover_winid = vim .api .nvim_open_win (M .hover_bufnr , remain_focused , {
54
66
focusable = true ,
@@ -147,4 +159,4 @@ function M.setup(options)
147
159
end
148
160
149
161
return M
150
- -- vim:ft=lua: ts=4:sts=4:noet:ai:si:sta:
162
+ -- vim:ts=4:sts=4:noet:ai:si:sta:
You can’t perform that action at this time.
0 commit comments