Trans.nvim/lua/Trans/core/action.lua

27 lines
783 B
Lua
Raw Normal View History

2023-01-14 10:29:01 +08:00
local function feedkey(mode, key)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, false, true), mode, false)
end
2023-01-14 14:22:25 +08:00
local util = require('Trans.util')
2023-01-14 10:29:01 +08:00
local M = {
2023-01-14 14:22:25 +08:00
pageup = function(bufnr, winid)
local top = math.min(10, util.get_height(bufnr, winid) - vim.api.nvim_win_get_height(winid) + 1)
return function()
vim.api.nvim_buf_call(bufnr, function()
2023-01-14 10:29:01 +08:00
-- TODO :
2023-01-14 14:22:25 +08:00
vim.cmd([[normal!]] .. top .. 'zt')
-- vim.cmd([[normal!]] .. 'G')
-- vim.api.nvim_command("noautocmd silent! normal! " .. vim.wo.scroll .. "zt")
-- vim.cmd([[do WinScrolled]])
2023-01-14 10:29:01 +08:00
end)
end
end,
2023-01-14 14:22:25 +08:00
pagedown = function()
2023-01-14 10:29:01 +08:00
feedkey('n', '<C-d>')
end
}
return M