improve ctrl-u/d scroll size
This commit is contained in:
@@ -23,13 +23,20 @@ vim.keymap.set('x', 'K', ":m '<-2<CR>gv=gv")
|
||||
vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]])
|
||||
|
||||
-- Scroll
|
||||
-- vim.keymap.set('n', '<C-d>', function()
|
||||
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'j')
|
||||
-- end)
|
||||
--
|
||||
-- vim.keymap.set('n', '<C-u>', function()
|
||||
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'k')
|
||||
-- end)
|
||||
local function scroll(cmd)
|
||||
local count = vim.v.count
|
||||
local height = vim.api.nvim_win_get_height(0)
|
||||
vim.opt_local.scroll = math.max(1, math.min(count > 0 and count or 20, height))
|
||||
vim.cmd.normal({ vim.api.nvim_replace_termcodes(cmd, true, false, true), bang = true })
|
||||
end
|
||||
|
||||
map('n', '<C-d>', function()
|
||||
scroll('<C-d>')
|
||||
end)
|
||||
|
||||
map('n', '<C-u>', function()
|
||||
scroll('<C-u>')
|
||||
end)
|
||||
|
||||
-- Easy to use registers
|
||||
map('x', '<leader>p', '"_dP')
|
||||
|
||||
Reference in New Issue
Block a user