Skip to content

obcat/vim-sclow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-sclow

Text-based scrollbar for Vim.

sclow eyecatch

Installation

Requires Vim compiled with +popupwin feature (Neovim is not supported).

If you use vim-plug, add the following line to your vimrc:

Plug 'obcat/vim-sclow'

You can use any other plugin manager.

Usage

No settings are required. A scrollbar will automatically appear on the right edge of the current window.

Tip

As you move the cursor and scroll, the scrollbar's position will be updated immediately.

On the other hand, if you scroll without moving the cursor (you can do this with <C-e> or <C-y> etc.), the scrollbar's position will be updated after the time specified with the updatetime option.

The default value of updatetime is 4000, i.e. 4 seconds. If you want to update the scrollbar's position as soon as possible, reduce the value of this option. I suggest around 100ms:

set updatetime=100

Note that updatetime also controls the delay before Vim writes its swap file (see :h updatetime).

Customization

You can customize some features.

Appearance

To customize scrollbar's appearance, you can use:

  • g:sclow_sbar_text (default: "\<Space>")
  • SclowSbar highlight group (default: links to Pmenu)

Examples:

sbar ex 1

let g:sclow_sbar_text = '*'
highlight link SclowSbar PmenuSel

sbar ex 2

let g:sclow_sbar_text = '👾👾'
highlight SclowSbar ctermbg=NONE guibg=NONE

📝 I use iceberg.vim for color scheme.

You can also customize the offset of the scrollbar from the right border of the window with g:sclow_bar_right_offset (default: 0). Setting this to -1 helps to prevent the scrollbar from hiding the rightmost characters of the window.

Blocking

To disable scrollbar in a specific buffer, you can use:

  • g:sclow_block_filetypes (default: [])
  • g:sclow_block_buftypes (default: [])

Example:

let g:sclow_block_filetypes = ['netrw', 'nerdtree']
let g:sclow_block_buftypes = ['terminal', 'prompt']

Hiding

By default, when both the first and last line of the buffer are in the window, a full-length scrollbar will be shown.

full-length sbar

If you want to hide this, use the following:

let g:sclow_hide_full_length = 1

See help file for more information.

Autohiding

By default the scrollbar will be shown on the screen permanently. If this behavior is undesirable, it is possible to automatically hide the scrollbar after a predefined period of inactivity.

To make scrollbar disappear after 2000ms set:

let g:sclow_auto_hide = 2000

License

MIT License.