DEV Community

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

Posted on

4

Another great neovim smooth scroll plugin

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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (2)

Collapse
 
thenaman047 profile image
TheNaman047

Thanks

Collapse
 
voyeg3r profile image
Sérgio Araújo

Currently I am using:

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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay