From b74dc3c0bebec8dcb3c0cfa7e44a8af124968c8b Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 7 Mar 2024 12:50:51 +0100 Subject: [PATCH] install neoscroll.nvim for smooth scrolling and additional keymaps --- lua/lazy-plugins.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index 69adc1d..80f8a6b 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -23,6 +23,34 @@ require('lazy').setup { 'tpope/vim-fugitive', 'tpope/vim-rhubarb', + -- Smooth scroll plugin and keymaps + { + 'karb94/neoscroll.nvim', + config = function() + require('neoscroll').setup { + hide_cursor = false, + easing_function = nil, + respect_scrolloff = true, + } + + require('neoscroll.config').set_mappings { + -- Scroll normally + [''] = { 'scroll', { '-vim.wo.scroll', 'true', '50' } }, + [''] = { 'scroll', { 'vim.wo.scroll', 'true', '50' } }, + -- Scroll entire page height + [''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '80' } }, + [''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '80' } }, + -- Scroll 10% at a time + [''] = { 'scroll', { '-0.10', 'false', '25' } }, + [''] = { 'scroll', { '0.10', 'false', '25' } }, + -- Jump to top, bottom and center + ['zt'] = { 'zt', { '40' } }, + ['zz'] = { 'zz', { '50' } }, + ['zb'] = { 'zb', { '40' } }, + } + end, + }, + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically