Skip to content

v2.0.0

Latest

Choose a tag to compare

@petertriho petertriho released this 18 Nov 10:04

v2 is a rewrite of nvim-scrollbar, and it replaces v1 on the main branch. See #121.

Important

v2 needs Neovim 0.11 or newer, and it rejects the v1 options. A v1 configuration with options fails setup until you migrate it. A call without options, require("scrollbar").setup(), works in both versions.

The default scrollbar and minimap while scrolling past diagnostics, Git hunks, and search matches

Migrate From v1

Follow the migration guide. For most v1 options, the setup error names the replacement and links the guide.

You must change your configuration if one of these is true:

  • You pass options to setup().
  • You use the scrollbar.handlers modules: the search, gitsigns, or ALE handler, or require("scrollbar.handlers").register(). The handlers are now providers in the top-level providers table. Custom handlers become custom providers.
  • You call require("scrollbar.utils").show(), hide(), or toggle(). Use require("scrollbar").show(), hide(), or toggle().
  • You call require("scrollbar").render(), clear(), throttled_render(), or on_scroll(). These are removed. To collect the marks again and render, use :ScrollbarRefresh or require("scrollbar").refresh().
  • You use Neovim older than 0.11.

Also check these changes. They do not cause an error:

  • The ScrollbarHandle and Scrollbar<Type>Handle highlight groups are now ScrollbarThumb and Scrollbar<Type>Thumb.
  • Search marks no longer need nvim-hlslens. Delete the v1 hlslens integration.
  • coc.nvim diagnostics need providers = { coc = true }.
  • v2 keeps the text out of the scrollbar columns. It sets the window-local 'sidescrolloff', or 'wrapcolumn' in a window with 'wrap', and restores the value when the scrollbar hides. To leave these options alone, set scrollbar.overlap.reserve = false.
  • Several defaults changed, for example the drawing, the mouse, and the update interval. See Default Changes.

Stay On v1

To keep v1, pin the v1 branch or the v1.0.0 tag. The v1 branch is frozen. It gets no more changes.

lazy.nvim:

{
    "petertriho/nvim-scrollbar",
    branch = "v1", -- or: version = "^1"
}

packer.nvim:

use({ "petertriho/nvim-scrollbar", branch = "v1" })

vim-plug:

Plug 'petertriho/nvim-scrollbar', { 'branch': 'v1' }

If you tried v2 with branch = "refactor/v2", remove the branch line.

What Is New

  • Floating scrollbars: one floating scrollbar for each source window. Each split window gets its own thumb.
  • Layouts: declarative column layouts with typed mark lanes. See Layout and geometry.
  • Presets and profiles: 12 scrollbar presets (vscode, zed, intellij, gvim, eclipse, sublime, emacs, xcode, minimal, review, search, and navigate), and contextual profiles that select a different appearance for each source window. See Presets.
  • Minimap: an optional floating minimap with Braille or block cells, Treesitter colors, opt-in LSP semantic-token colors, a scrolling or a fitted scale, provider marks, and 8 presets. See Minimap.
  • Providers: native search marks without nvim-hlslens, native letter marks, and new providers for mini.diff, vim-signify, vgit.nvim, and coc.nvim. A custom provider API adds other data sources.
  • Mouse: clicks on marks and on the track, and thumb dragging. See Mouse.
  • Visibility: autohide, and a scrollbar that hides while the cursor is in its cells. With hide_on_cursor = "row", the scrollbar clears only the row of the cursor. See Visibility.
  • Overlap: the text stays out of the scrollbar columns by default. overlap.show_through shows the text through the scrollbar, and overlap.marks = "tint" draws the marks as background colors. See Overlap.
  • Exclude: an exclude.when function excludes the windows that it selects. By default, exclude.unfocusable excludes the normal windows that are not focusable. See Exclude.
  • Window options: window sets the nvim_open_win() options and the window-local options of the scrollbar float and the minimap float, for example a border. See Window.
  • Pickers and floats: opt-in scrollbars and minimaps on the list and the preview of the snacks.nvim picker, on the results and the preview of the Telescope picker, and on other floats that a function selects. See Floats.
  • Screen lines: scrollbar.unit = "screenline" positions follow wraps and folds.
  • Commands: :ScrollbarRefresh, and :MinimapShow, :MinimapHide, :MinimapToggle, and :MinimapRefresh.
  • Validation: setup rejects unknown keys and invalid values, and the error names the problem.

The showcase has a screenshot and the setup of every scrollbar preset and minimap preset.

Full changelog: v1.0.0...v2.0.0