vim-line-no-indicator


Ⅰ. 插件描述

Simple and expressive line number indicator.

Ⅱ. 基本信息

创建日期:  2017-09-02
使用用户:  12
Github星:  99
插件作者:  Sheldon Johnson

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'drzel/vim-line-no-indicator'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'drzel/vim-line-no-indicator'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'drzel/vim-line-no-indicator'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/drzel/vim-line-no-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.

添加新评论