• Stars
    star
    124
  • Rank 281,955 (Top 6 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 9 months 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.