fix: add auto_close_autocmd

This commit is contained in:
JuanZoran
2023-03-15 16:07:07 +08:00
parent c699aaba24
commit 52238cb1e7
6 changed files with 92 additions and 28 deletions

View File

@ -1,21 +1,49 @@
local api = vim.api
---@type table<string, fun(hover: TransHover)>
local strategy = {
play = function()
print('TODO: play')
pageup = function(hover)
hover.buffer:normal('gg')
end,
pageup = function()
print('TODO: pageup')
pagedown = function(hover)
hover.buffer:normal('G')
end,
pagedown = function()
print('TODO: pagedown')
end,
pin = function()
print('TODO: pin')
pin = function(hover)
if hover.pin then return end
local window = hover.window
local width, height = window:width(), window:height()
local col = vim.o.columns - width - 3
window:try_close()
window = hover:init_window({
width = width,
height = height,
relative = 'editor',
col = col,
})
window:set('wrap', true)
hover.pin = true
end,
close = function(hover)
hover:destroy()
end,
toggle_entry = function()
print('TODO: toggle_entry')
toggle_entry = function(hover)
if api.nvim_get_current_win() ~= hover.window.winid then
api.nvim_set_current_win(hover.window.winid)
return
end
for _, winid in ipairs(api.nvim_list_wins()) do
if winid ~= hover.window.winid then
api.nvim_set_current_win(winid)
break
end
end
end,
}