• Stars
    star
    526
  • Rank 83,767 (Top 2 %)
  • Language
    Lua
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Neovim plugin that displays interactive vertical scrollbars and signs.

build

nvim-scrollview

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

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

Features

  • Handling for folds
  • Scrollbars can be dragged with the mouse
  • Partially transparent scrollbars so that text is not covered
  • Signs (diagnostics and search enabled by default)

Requirements

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

Installation

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

Examples
  • 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.
  • :ScrollViewDisable disables the plugin. When arguments are given, the specified sign groups are disabled.
  • :ScrollViewEnable enables the plugin. This is only necessary if nvim-scrollview has previously been disabled. When arguments are given, the specified sign groups are enabled.
  • :ScrollViewToggle toggles the plugin. When arguments are given, the specified sign groups are toggled.
  • :ScrollViewRefresh refreshes the scrollbars and signs. This is relevant when the scrollbars or signs are out-of-sync, which can occur as a result of some window arrangement actions.
  • :ScrollViewNext, :ScrollViewPrev, :ScrollViewFirst, and ScrollViewLast move the cursor to lines with signs. Arguments can specify which sign groups are considered.
  • The scrollbars can be dragged and signs can be clicked. This requires a corresponding mapping, which is automatically configured when scrollview_auto_mouse is set (see :help scrollview-mouse-customization).

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.

  • conflicts: git merge conflicts
  • cursor: cursor position
  • diagnostics: errors, warnings, info, and hints
  • folds: closed folds
  • loclist: items on the location list
  • marks
  • quickfix: items on the quickfix list
  • search
  • spell: spell check items when the spell option is enabled
  • textwidth: line lengths exceeding the value of the textwidth option, when non-zero
  • trail: trailing whitespace, when the list option is enabled and the listchars option includes "trail"

search and diagnostics groups are enabled by default. 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.

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. Plugin authors can tag their repos with scrollview-signs for discoverability.

Configuration

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

Vimscript Example

let g:scrollview_excluded_filetypes = ['nerdtree']
let g:scrollview_current_only = v:true
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
" 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,
  winblend = 75,
  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.excluded_filetypes = {'nerdtree'},
vim.g.current_only = true,
vim.g.winblend = 75,
vim.g.base = 'buffer',
vim.g.column = 80,
vim.g.signs_on_startup = {'all'},
vim.g.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.

More Repositories

1

vim-startuptime

A plugin for profiling Vim and Neovim startup time.
Vim Script
576
star
2

gifcast

Converts an asciinema cast to an animated GIF.
JavaScript
221
star
3

vim-win

A Vim plugin for managing windows.
Vim Script
66
star
4

highlight

A browser extension for automatically highlighting the important content on article pages.
JavaScript
52
star
5

kmeans1d

A Python package for optimal 1D k-means clustering.
C++
47
star
6

k-means-quantization-js

Apply color quantization to images using k-means clustering.
JavaScript
36
star
7

pastiche

A PyTorch implementation of Neural Style Transfer (Gatys et al. 2015).
Python
28
star
8

pyfms

A Theano-based Python implementation of Factorization Machines (Rendle 2010).
Python
27
star
9

vim-menu

A plugin providing a console interface to Vim's built-in menu.
Vim Script
25
star
10

vimgolf

A vimgolf client written in Python.
Python
25
star
11

neuralart

A library and command line utility for rendering generative art from a randomly initialized neural network.
Python
22
star
12

colortrans

An implementation of various color transfer algorithms.
Python
14
star
13

workflows

View the status of GitHub workflows.
JavaScript
11
star
14

aghasher

An implementation of Anchor Graph Hashing (Liu et al. 2011) in Python.
Python
9
star
15

vim-smile

A Vim plugin with a :Smile command.
Vim Script
6
star
16

revdoor

A single-file C++ library for visiting revolving door combinations.
C++
6
star
17

fenwick

An implementation of Fenwick trees (Fenwick 1994).
Python
5
star
18

euler-lisp-helpers

Functions that are useful for solving Project Euler problems with Common Lisp.
Common Lisp
5
star
19

neovim-windows-nightly

4
star
20

scct4j

A self-contained CRUD template for Java.
Java
4
star
21

LC4

An implementation of ElsieFour (Alan Kaminsky 2017).
Python
3
star
22

dotfiles

My personal dotfiles.
Vim Script
2
star
23

hn-duplicate-detector

Detects duplicate HN submissions.
JavaScript
1
star
24

dstein64

Renders a new image hourly, using dstein64/neuralart.
1
star