Support documentation window scrolling

This commit is contained in:
hrsh7th
2021-08-09 19:34:45 +09:00
parent 421720641b
commit a11ddccb33
6 changed files with 62 additions and 2 deletions

View File

@@ -69,6 +69,16 @@ end
---Keypress handler
core.on_keymap = function(keys, fallback)
-- Documentation scroll
if config.get().documentation.mapping[keys] then
if config.get().documentation.mapping[keys] == types.cmp.ScrollDirection.Up then
core.menu.float:scroll(-4)
elseif config.get().documentation.mapping[keys] == types.cmp.ScrollDirection.Down then
core.menu.float:scroll(4)
end
return
end
-- Confirm character
if config.get().confirmation.mapping[keys] then
local c = config.get().confirmation.mapping[keys]
@@ -110,6 +120,9 @@ core.prepare = function()
for keys in pairs(config.get().confirmation.mapping) do
keymap.listen(keys, core.on_keymap)
end
for keys in pairs(config.get().documentation.mapping) do
keymap.listen(keys, core.on_keymap)
end
end
---Check auto-completion