From bd2c3c53034cc1768b16cc242d9c35da13ba7a3c Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Fri, 20 Mar 2026 01:09:04 +0100 Subject: [PATCH] nvim with neoscroll+smear --- CONFIG/nvim/init.lua | 57 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/CONFIG/nvim/init.lua b/CONFIG/nvim/init.lua index 004233b..15df299 100644 --- a/CONFIG/nvim/init.lua +++ b/CONFIG/nvim/init.lua @@ -553,6 +553,29 @@ local function makespec_lspconfig() } end +local function makespec_smearcursor() + return { + "sphamba/smear-cursor.nvim", + event = "VeryLazy", + opts = { + enabled = false, -- Dormant on startup + stiffness = 0.8, + trailing_stiffness = 0.5, + }, + } +end + +local function makespec_neoscroll() + return { + "karb94/neoscroll.nvim", + event = "VeryLazy", + config = function() + -- Initialize with empty mappings. It is loaded, but completely dormant. + require("neoscroll").setup({ mappings = {} }) + end, + } +end + local function makespec_hexokinase() return { -- coloring of colornames @@ -1161,6 +1184,36 @@ local function makespec_snacks() Snacks.toggle.option("spell", { name = "Spelling" }):map("us") Snacks.toggle.treesitter():map("ut") Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + -- Toggle for Smear Cursor + Snacks.toggle({ + name = "Smear Cursor", + get = function() return require("smear_cursor").enabled end, + set = function(state) require("smear_cursor").enabled = state end, + }):map("uS") + + -- Toggle for Neoscroll + local ns_keys = { "", "", "", "", "", "", "zt", "zz", "zb" } + vim.g.neoscroll_enabled = false + + Snacks.toggle({ + name = "Smooth Scroll", + get = function() return vim.g.neoscroll_enabled end, + set = function(state) + vim.g.neoscroll_enabled = state + if state then + -- Turn ON: Tell neoscroll to hijack the keys + require("neoscroll").setup({ + mappings = ns_keys, + hide_cursor = true, + }) + else + -- Turn OFF: Delete the hijacks so Neovim returns to default scrolling + for _, key in ipairs(ns_keys) do + pcall(vim.keymap.del, { "n", "v", "x" }, key) + end + end + end, + }):map("uN") end, }) end, @@ -1637,8 +1690,6 @@ local function makespec_noice() { "lx", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, { "lh", function() require("noice").cmd("all") end, desc = "Noice History" }, { "ls", function() require("noice").cmd("stats") end, desc = "Noice Stats" }, - { "un", function() require("noice").cmd("enable") end, desc = "Enable Noice" }, - { "uN", function() require("noice").cmd("disable") end, desc = "Disable Noice" }, }, } end @@ -1673,6 +1724,8 @@ for _, spec in ipairs({ makespec_flash(), makespec_grugfar(), -- visuals + makespec_neoscroll(), + makespec_smearcursor(), makespec_hexokinase(), makespec_lualine(), makespec_noice(),