From b0ce1f2c0b9bfc101d50de5c2dcb26d89419cf86 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Sat, 30 Mar 2024 16:23:58 +0100 Subject: [PATCH] isolate smooth scroll plugin to customs --- lua/custom/plugins/neoscroll.lua | 27 +++++++++++++++++++++++++++ lua/lazy-plugins.lua | 28 ---------------------------- 2 files changed, 27 insertions(+), 28 deletions(-) create mode 100644 lua/custom/plugins/neoscroll.lua diff --git a/lua/custom/plugins/neoscroll.lua b/lua/custom/plugins/neoscroll.lua new file mode 100644 index 0000000..13d210b --- /dev/null +++ b/lua/custom/plugins/neoscroll.lua @@ -0,0 +1,27 @@ +-- Smooth scroll plugin and keymaps +return { + '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, +} diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index 7b0edcc..0b713bf 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -22,34 +22,6 @@ require('lazy').setup({ -- Processing-Java 'sophacles/vim-processing', - -- 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