improve ctrl-u/d scroll size
This commit is contained in:
@@ -205,9 +205,3 @@ au('UIEnter', {
|
|||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('VimResized', {
|
|
||||||
callback = function()
|
|
||||||
vim.opt.scroll = 20
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -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>]])
|
vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]])
|
||||||
|
|
||||||
-- Scroll
|
-- Scroll
|
||||||
-- vim.keymap.set('n', '<C-d>', function()
|
local function scroll(cmd)
|
||||||
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'j')
|
local count = vim.v.count
|
||||||
-- end)
|
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.keymap.set('n', '<C-u>', function()
|
vim.cmd.normal({ vim.api.nvim_replace_termcodes(cmd, true, false, true), bang = true })
|
||||||
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'k')
|
end
|
||||||
-- end)
|
|
||||||
|
map('n', '<C-d>', function()
|
||||||
|
scroll('<C-d>')
|
||||||
|
end)
|
||||||
|
|
||||||
|
map('n', '<C-u>', function()
|
||||||
|
scroll('<C-u>')
|
||||||
|
end)
|
||||||
|
|
||||||
-- Easy to use registers
|
-- Easy to use registers
|
||||||
map('x', '<leader>p', '"_dP')
|
map('x', '<leader>p', '"_dP')
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ vim.opt.autoindent = true -- Copy indent from the current line when starting a n
|
|||||||
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
|
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
|
||||||
|
|
||||||
-- Scroll and mouse
|
-- Scroll and mouse
|
||||||
vim.opt.scroll = 20
|
vim.opt.scroll = 0
|
||||||
vim.opt.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
vim.opt.sidescrolloff = 5
|
vim.opt.sidescrolloff = 5
|
||||||
vim.opt.mousescroll = 'hor:1,ver:1'
|
vim.opt.mousescroll = 'hor:1,ver:1'
|
||||||
|
|||||||
Reference in New Issue
Block a user