Home

Awesome

build

nvim-scrollview

nvim-scrollview is a Neovim plugin that displays interactive vertical scrollbars and signs. The plugin is customizable (see :help scrollview-configuration).

<img src="https://github.com/dstein64/media/blob/main/nvim-scrollview/screenshot.svg?raw=true" width="600" />

<sub>(a scrollbar and signs can be seen near the right edge of the preceding image)</sub>

Features

Requirements

Installation

A package manager can be used to install nvim-scrollview.

<details><summary>Examples</summary><br> </details>

Usage

Signs

There is built-in support for various types of signs (referred to as "sign groups"), listed below. The functionality is similar to the sign column, but with the same positioning logic as the scrollbar.

search and diagnostics groups are enabled by default (marks too for nvim>=0.10). To modify which sign groups are enabled, set scrollview_signs_on_startup accordingly in your Neovim configuation (see :help scrollview_signs_on_startup), or use :ScrollViewEnable {group1} {group2} ... to enable sign groups in the current Neovim session.

Clicking on a sign will navigate to its associated line. If a sign is linked to multiple lines, successive clicks will cycle through these lines. Right-clicking a sign reveals additional information, including its sign group and the corresponding lines, which can be selected for navigation. Identifying the sign group can be helpful if you are unsure what a sign represents.

The plugin was written so that it's possible to extend the sign functionality in a Neovim configuration file or with a plugin. See the documentation for details.

The contrib directory contains sign group implementations that are not built-in (e.g., coc, gitsigns), but may be useful to some users. The code there does not receive the same level of support as the main source code, and may be less stable. Use at your own risk. For installation instructions and other documentation, see the source code files.

Configuration

There are various settings that can be configured. Please see the documentation for details. The code below only shows a few of the possible settings.

Vimscript Example

let g:scrollview_excluded_filetypes = ['nerdtree']
let g:scrollview_current_only = v:true
" Position the scrollbar at the 80th character of the buffer
let g:scrollview_base = 'buffer'
let g:scrollview_column = 80
" Enable all sign groups (defaults to ['diagnostics', 'search']).
" Set to the empty list to disable all sign groups.
let g:scrollview_signs_on_startup = ['all']
" Show diagnostic signs only for errors.
let g:scrollview_diagnostics_severities =
      \ [luaeval('vim.diagnostic.severity.ERROR')]

Lua Example

A Lua setup() function is provided for convenience, to set globally scoped options (the 'scrollview_' prefix is omitted).

require('scrollview').setup({
  excluded_filetypes = {'nerdtree'},
  current_only = true,
  base = 'buffer',
  column = 80,
  signs_on_startup = {'all'},
  diagnostics_severities = {vim.diagnostic.severity.ERROR}
})

Alternatively, configuration variables can be set without calling setup().

vim.g.scrollview_excluded_filetypes = {'nerdtree'},
vim.g.scrollview_current_only = true,
vim.g.scrollview_base = 'buffer',
vim.g.scrollview_column = 80,
vim.g.scrollview_signs_on_startup = {'all'},
vim.g.scrollview_diagnostics_severities = {vim.diagnostic.severity.ERROR}

Documentation

Documentation can be accessed with:

:help nvim-scrollview

The underlying markup is in scrollview.txt.

Issues

Documentation for issues, along with some workarounds, can be accessed with:

:help scrollview-issues

Some of the known issues are regarding scrollbar synchronization, error messages, session restoration, and scrollbar floating windows being included in the window count returned by winnr('$').

License

The source code has an MIT License.

See LICENSE.