Another great neovim smooth scroll plugin
Sérgio Araújo

Sérgio Araújo @voyeg3r

About: I am a Free Software enthusiast and a (neo)?vim addicted, I also like shell script, sed, awk, and as you can see I love Regular Expressions.

Location:
Brazil
Joined:
Sep 23, 2017

Another great neovim smooth scroll plugin

Publish Date: Jul 17 '24
5 2

The missing smooth scroll

As far as I know neovim does not have a decent scroll feaure, the jumps are so fast you can become confused.

I have being using neoscroll for a while, but now I am using cinnamon:

-- File: ~/.config/nvim/lua/plugins/cinnamon.lua
-- Last Change: Wed, Jul 2024/07/17 - 08:38:44
-- Author: Sergio Araujo-- 
--
-- This plugin is for animated scrolling

return {
  "declancm/cinnamon.nvim",
  version = "*", -- use latest release
  opts = {
    -- change default options here
    -- Enable all provided keymaps
    keymaps = {
      basic = true,
      extra = true,
    },
    -- Custom scroll options
    options = {
      mode = "cursor",  -- Animate cursor and window scrolling for any movement
      delay = 5,        -- Delay between each movement step (in ms)
      step_size = {
        vertical = 1,   -- Number of cursor/window lines moved per step
        horizontal = 2, -- Number of cursor/window columns moved per step
      },
      max_delta = {
        line = false,   -- Maximum distance for line movements before scroll animation is skipped
        column = false, -- Maximum distance for column movements before scroll animation is skipped
        time = 1000,    -- Maximum duration for a movement (in ms)
      },
      -- Optional post-movement callback
      callback = function()
        -- print("Scrolling done!")
      end,
    },

  },
  keys = {
    { '<c-d>', '<cmd>lua require("cinnamon").scroll("<C-d>zz")<cr>', mode = 'n', },
    { '<c-u>', '<cmd>lua require("cinnamon").scroll("<C-u>zz")<cr>', mode = 'n', },
    { '<c-f>', '<cmd>lua require("cinnamon").scroll("<C-f>zz")<cr>', mode = 'n', },
    { '<c-b>', '<cmd>lua require("cinnamon").scroll("<C-b>zz")<cr>', mode = 'n', },
    { 'zz',    '<cmd>lua require("cinnamon").scroll("zz")<cr>',      mode = 'n', },
    { 'zt',    '<cmd>lua require("cinnamon").scroll("zt")<cr>',      mode = 'n', },
    { 'zb',    '<cmd>lua require("cinnamon").scroll("zb")<cr>',      mode = 'n', },
    { 'gg',    '<cmd>lua require("cinnamon").scroll("gg")<cr>',      mode = 'n', },
    { 'G',    '<cmd>lua require("cinnamon").scroll("G")<cr>',      mode = 'n', },
  }
}
Enter fullscreen mode Exit fullscreen mode

Please give us your feedback

Comments 2 total

  • TheNaman047
    TheNaman047Sep 4, 2024

    Thanks

    • Sérgio Araújo
      Sérgio AraújoJan 12, 2025

      Currently I am using:

      -- https://github.com/sphamba/smear-cursor.nvim
      return {
        "sphamba/smear-cursor.nvim",
        opts = {},
      }
      
      Enter fullscreen mode Exit fullscreen mode
Add comment