Vim-Scrollbar Vim Plugin

I was annoyed at not being able to determine where I was in the file and how long the file was in terminal vim since it lacked a scrollbar (my statusline has the percentage location in the file, but that wasn’t very intuitive to look at), so I made a plugin that displays a scrollbar to the left using vim’s “signs”. This is similar to another scrollbar plugin I found, but for some reason, that one didn’t work for me. The code is based on an answer to this question on Super User, though I modified it a lot. I hosted the code on GitHub to allow it to be easily downloaded using common vim plugin managers like Vundle.

The frequency of updating the position, scrollbar thumb and line colour and appearance, and whether it should be draggable using the mouse (to scroll) can be configured using variables, and the scrollbar can be turned on and off. The main issues are that signs can’t be placed on soft-wrapped lines, so there ends up being a gap that messes up the scrollbar whenever soft-wrapping happens, and that when dragging the scrollbar using the mouse to move down the file, it only updates on mouse release. The first I think is a vim limitation, while the second could possibly be fixed by occasionally updating the position while dragging.

As mentioned, the plugin is available on GitHub here: https://github.com/Zarainia/vim-scrollbar

Leave a comment