DEV Community

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

Posted on

5

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

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

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

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay