dstein64/nvim-scrollview

github github
scrollbar
star 318
stars
alert-circle 8
open issues
users 5
subscribers
git-branch 7
forks
CREATED

2020-12-10

UPDATED

2 months ago


build

nvim-scrollview

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

Features

  • Handling for folds
  • Scrollbars can be dragged with the mouse
  • Partially transparent scrollbars so that text is not covered

Requirements

  • nvim>=0.5
  • Scrollbar mouse dragging requires mouse support (see :help 'mouse') and nvim>=0.6

Installation

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

  • Vim8 packages:
    • git clone https://github.com/dstein64/nvim-scrollview ~/.local/share/nvim/site/pack/plugins/start/nvim-scrollview
  • Vundle:
    • Add Plugin 'dstein64/nvim-scrollview' to ~/.config/nvim/init.vim
    • :PluginInstall or $ nvim +PluginInstall +qall
  • Pathogen:
    • git clone --depth=1 https://github.com/dstein64/nvim-scrollview ~/.local/share/nvim/site/bundle/nvim-scrollview
  • vim-plug:
    • Add Plug 'dstein64/nvim-scrollview', { 'branch': 'main' } to ~/.config/nvim/init.vim
    • :PlugInstall or $ nvim +PlugInstall +qall
  • dein.vim:
    • Add call dein#add('dstein64/nvim-scrollview') to ~/.config/nvim/init.vim
    • :call dein#install()
  • NeoBundle:
    • Add NeoBundle 'dstein64/nvim-scrollview' to ~/.config/nvim/init.vim
    • Re-open Neovim or execute :source ~/.config/nvim/init.vim
  • packer.nvim:
    • Add use 'dstein64/nvim-scrollview' to the packer startup function
    • :PackerInstall

Usage

  • nvim-scrollview works automatically, displaying interactive scrollbars.
  • The :ScrollViewDisable command disables scrollbars.
  • The :ScrollViewEnable command enables scrollbars. This is only necessary if scrollbars have previously been disabled.
  • The :ScrollViewRefresh command refreshes the scrollbars. This is relevant when the scrollbars are out-of-sync, which can occur as a result of some window arrangement actions.
  • The scrollbars can be dragged. This requires a corresponding mapping, which is automatically configured when scrollview_auto_mouse is set (see :help scrollview-mouse-customization).

Configuration

There are various settings that can be configured. Please see the documentation for details.

  • Whether scrollbars are enabled or disabled on startup
    • scrollview_on_startup
  • File types for which scrollbars should not be displayed
    • scrollview_excluded_filetypes
  • Scrollbar color and transparency level
    • ScrollView highlight group
    • scrollview_winblend
  • Whether scrollbars should be displayed in all windows, or just the current window
    • scrollview_current_only
  • What the scrollbar position and size correspond to (i.e., how folds are accounted for)
    • scrollview_mode
  • Scrollbar anchor column and offset
    • scrollview_base
    • scrollview_column
  • Whether a mapping is automatically created for mouse support
    • scrollview_auto_mouse
  • Whether select workarounds are automatically applied for known issues
    • scrollview_auto_workarounds
  • Refresh time limit that triggers setting scrollview_mode to simple
    • scrollview_refresh_time
  • A character to display on scrollbars
    • scrollview_character
  • Whether each scrollbar becomes hidden when intersecting a floating window
    • scrollview_hide_on_intersect

VimScript Example

let g:scrollview_excluded_filetypes = ['nerdtree']
let g:scrollview_current_only = 1
let g:scrollview_winblend = 75
" Position the scrollbar at the 80th character of the buffer
let g:scrollview_base = 'buffer'
let g:scrollview_column = 80

Lua Setup Example

require('scrollview').setup({
  excluded_filetypes = {'nerdtree'},
  current_only = true,
  winblend = 75,
  base = 'buffer',
  column = 80
})

Documentation

Documentation can be accessed with:

:help nvim-scrollview

The underlying markup is in scrollview.txt.

License

The source code has an MIT License.

See LICENSE.