A Neovim plugin for continuous scrolling across multiple windows, ideal for comparing different sections of the same file. Perfectly suited for ultrawide monitors, enabling comfortable viewing of multiple vertical splits of a long document.
Screen.Recording.2025-01-06.at.16.23.23.mov
- Automatic Scroll Sync: Keeps scrolling synchronized across all windows displaying the same buffer.
- Configurable Overlap: Define the number of overlapping lines between adjacent windows.
- Customizable Line Numbers: Choose to hide line numbers in synchronized windows.
- Bidirectional Support: Syncs scrolling both forward and in reverse directions.
Using lazy.nvim:
{
"jackplus-xyz/scroll-it.nvim",
opts = {
-- Add your configuration here
}
}
scroll-it.nvim
comes with the following default configuration:
{
enabled = false, -- Enable the plugin on startup
reversed = false, -- Reverse the continuous direction (default: left-to-right, top-to-bottom)
hide_line_number = "others", -- Options: "all" | "others" | "none"
-- "all": Show line numbers in all windows
-- "none": Hide line numbers in all synchronized windows
-- "others": Hide line numbers in all but the focused window
overlap_lines = 0, -- Number of lines to overlap between adjacent windows
}
Example configuration with lazy.nvim
:
require("lazy").setup({
{
"jackplus-xyz/scroll-it.nvim",
lazy = false, -- Set to `true` to lazy-load the plugin, or `false` to load it on startup
opts = {
enabled = true, -- Activates the plugin's functionality after it is loaded
-- (Note: This does NOT determine whether the plugin is lazy-loaded)
reversed = true, -- Reverse the content extending direction
hide_line_number = "all", -- Show line numbers in all windows
overlap_lines = 4, -- Number of lines to overlap between adjacent windows for better readability
},
},
})
The plugin provides the following commands:
:ScrollItEnable
- Enable scroll synchronization:ScrollItDisable
- Disable scroll synchronization:ScrollItToggle
- Toggle scroll synchronization
When enabled, scroll-it.nvim
monitors all windows displaying the same buffer and:
- Detects window positions and orders them based on their layout
- Synchronizes scrolling based on the active window
- Maintains configurable overlap between adjacent windows
- Updates window positions whenever you scroll or change window layouts
- Works well with smooth scrolling
- Use with vertical splits for comparing different sections of the same file
- Adjust
overlap_lines
to maintain context between windows - Toggle line numbers visibility for cleaner comparison views
- The
reversed
option can be useful for reviewing code changes in opposite directions
- This plugin is inspired and develped by folllowing the Neovim Plugin From Scratch from the Advent of Neovim: Why Neovim? series by tjdevries (TJ DeVries). It makes making my first Neovim plugin a lot less scary.
- Special thanks to folke/snacks.nvim: 🍿 A collection of small QoL plugins for Neovim for being an excellent resource on implementing and structuring Neovim plugins.
- neovide/neovide: No Nonsense Neovim Client in Rust for making stunning demonstration of the plugin.
MIT