Skip to content

A Neovim plugin that displays long documents continuously across multiple windows.

License

Notifications You must be signed in to change notification settings

jackplus-xyz/scroll-it.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scroll-it.nvim

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.

Demo

Screen.Recording.2025-01-06.at.16.23.23.mov

Features

  • 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.

Installation

Using lazy.nvim:

{
    "jackplus-xyz/scroll-it.nvim",
    opts = {
        -- Add your configuration here
    }
}

Configuration

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
        },
    },
})

Usage

The plugin provides the following commands:

  • :ScrollItEnable - Enable scroll synchronization
  • :ScrollItDisable - Disable scroll synchronization
  • :ScrollItToggle - Toggle scroll synchronization

How it works

When enabled, scroll-it.nvim monitors all windows displaying the same buffer and:

  1. Detects window positions and orders them based on their layout
  2. Synchronizes scrolling based on the active window
  3. Maintains configurable overlap between adjacent windows
  4. Updates window positions whenever you scroll or change window layouts

Tips

  • 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

Credits

License

MIT

About

A Neovim plugin that displays long documents continuously across multiple windows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages