• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

Simple and expressive line number indicator.

vim-line-no-indicator

A simple line number indicator.

vim-line-no-indicator-small

Why?

I have line numbers displayed (set number) when editing code, so I already know what line number I'm on. I just need something to show me roughly how far through the document I am, without taking up 4+ characters in my statusline.

Installation

Install with a plugin manager.

Usage

Add %{LineNoIndicator()} to your statusline. For example:

set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %{LineNoIndicator()}

See :help 'statusline' for more information about doing this.

vim-lightline

I use vim-lightline. My settings look like this:

let g:lightline.component = {
      \   'indicator': '%{LineNoIndicator()}'
      \ }

let g:lightline.active = {
      \   'left': [
      \     [ 'mode', 'paste' ],
      \     [ 'readonly', 'relativepath', 'modified' ]
      \   ],
      \   'right': [
      \     [ 'indicator' ],
      \     [ 'lineinfo' ]
      \   ]
      \ }

let g:lightline.inactive = {
      \   'left': [
      \     [ 'filename' ]
      \   ],
      \   'right': [
      \     [ 'indicator' ],
      \     [ 'lineinfo' ]
      \   ]
      \ }

vim-airline

I used to use vim-airline. My settings looked like this:

let g:airline_section_x = '%{&filetype}'
let g:airline_section_y = '%#__accent_bold#%{LineNoIndicator()}%#__restore__#'
let g:airline_section_z = '%2c'

Configuration

" Defaults
let g:line_no_indicator_chars = ['⎺', '⎻', '─', '⎼', '⎽'] " on macOS
let g:line_no_indicator_chars = ['⎺', '⎻', '⎼', '⎽', '⎯'] " on Linux

The chars above look different between my Mac and Ubuntu machines for some reason, so the above are the respective defaults. If neither of these are right for you, create an issue.

Some alternatives:

" one char wide solid vertical bar
let g:line_no_indicator_chars = [
  \  'Β ', '▁', 'β–‚', 'β–ƒ', 'β–„', 'β–…', 'β–†', 'β–‡', 'β–ˆ'
  \  ]

" two char wide fade-in blocks
let g:line_no_indicator_chars = [
  \ 'Β Β ', 'β–‘Β ', 'β–’Β ', 'β–“Β ', 'β–ˆΒ ', 'β–ˆβ–‘', 'β–ˆβ–’', 'β–ˆβ–“', 'β–ˆβ–ˆ'
  \ ]

" three char wide solid horizontal bar
let g:line_no_indicator_chars = [
  \ '   ', '▏  ', 'β–Ž  ', '▍  ', 'β–Œ  ',
  \ 'β–‹  ', 'β–Š  ', 'β–‰  ', 'β–ˆ  ', 'β–ˆβ– ',
  \ 'β–ˆβ–Ž ', 'β–ˆβ– ', 'β–ˆβ–Œ ', 'β–ˆβ–‹ ', 'β–ˆβ–Š ',
  \ 'β–ˆβ–‰ ', 'β–ˆβ–ˆ ', 'β–ˆβ–ˆβ–', 'β–ˆβ–ˆβ–Ž', 'β–ˆβ–ˆβ–',
  \ 'β–ˆβ–ˆβ–Œ', 'β–ˆβ–ˆβ–‹', 'β–ˆβ–ˆβ–Š', 'β–ˆβ–ˆβ–‰', 'β–ˆβ–ˆβ–ˆ'
  \ ]
Β 

Note: The above chars might look a little janky in your browser, but probably render okay in your terminal.

Screenshots

Before

Default vim-airline statusline: Before

After

With vim-line-no-indicator and vim-airline settings as above: After

Screenshots in Tilix, running neovim with roboto mono font, nord colorscheme and vim-airline statusline.

What people are saying about vim-line-no-indicator

justinmk:

Cool. I used noscrollbar for a long time, but sometimes wished for this approach instead.

romainl:

I don't think it's of any use.