Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add NoScrollBar to LightLine

📅 2017-Oct-25 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

LightLine is a lightweight statusline plugin for Vim. By default, it shows the location of current line relative to the entire file as a percent at the left of the statusbar.

However, I like to the NoScrollBar plugin to get a general sense of the current line in the file. So, I replaced the percent display with the output of NoScrollBar using a tiny function.

I added these lines in Vim to achieve this:

" Replace percent component of Lightline statusline
let g:lightline = {
      \ 'component_function': {
      \   'percent': 'NoScrollbarForLightline'
      \ }
      \ }

" Instead of % show NoScrollbar horizontal scrollbar
function! NoScrollbarForLightline()
    return noscrollbar#statusline()

Tried with: Vim 7.4 and Ubuntu 16.04