Repository navigation
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.
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.handlersmodules: the search, gitsigns, or ALE handler, orrequire("scrollbar.handlers").register(). The handlers are now providers in the top-levelproviderstable. Custom handlers become custom providers. - You call
require("scrollbar.utils").show(),hide(), ortoggle(). Userequire("scrollbar").show(),hide(), ortoggle(). - You call
require("scrollbar").render(),clear(),throttled_render(), oron_scroll(). These are removed. To collect the marks again and render, use:ScrollbarRefreshorrequire("scrollbar").refresh(). - You use Neovim older than 0.11.
Also check these changes. They do not cause an error:
- The
ScrollbarHandleandScrollbar<Type>Handlehighlight groups are nowScrollbarThumbandScrollbar<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, setscrollbar.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.
{
"petertriho/nvim-scrollbar",
branch = "v1", -- or: version = "^1"
}use({ "petertriho/nvim-scrollbar", branch = "v1" })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, andnavigate), 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_throughshows the text through the scrollbar, andoverlap.marks = "tint"draws the marks as background colors. See Overlap. - Exclude: an
exclude.whenfunction excludes the windows that it selects. By default,exclude.unfocusableexcludes the normal windows that are not focusable. See Exclude. - Window options:
windowsets thenvim_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
