/vim-scrollstatus

A Vim plugin to display a scrollbar in the statusline

Primary LanguageVim ScriptBSD 2-Clause "Simplified" LicenseBSD-2-Clause

vim-scrollstatus

A scrollbar for Vim statusline. For Neovim, check out nvim-scrollbar.

demo

Installation

With vim-plug:

call plug#begin()
Plug 'ojroques/vim-scrollstatus'
call plug#end()

Usage

With vim-airline:

let g:airline_section_x = '%{ScrollStatus()}'

With lightline.vim:

let g:lightline = {
  \ 'active': {
  \   'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype', 'charvaluehex']]
  \ },
  \ 'component_function': {'percent': 'ScrollStatus'},
  \ }

Configuration

By default the scrollbar is 20 characters long. You can set another value with:

let g:scrollstatus_size = 12

By default the symbols are set to for the track and for the bar. To change them:

let g:scrollstatus_symbol_track = '-'
let g:scrollstatus_symbol_bar = '|'

Example

To reproduce the statusline from the screenshot:

call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'ojroques/vim-scrollstatus'
call plug#end()

let g:airline_section_x = '%{ScrollStatus()} '
let g:airline_section_y = airline#section#create_right(['filetype'])
let g:airline_section_z = airline#section#create([
            \ '%#__accent_bold#%3l%#__restore__#/%L', ' ',
            \ '%#__accent_bold#%3v%#__restore__#/%3{virtcol("$") - 1}',
            \ ])