项目作者: MahbubAlam231

项目描述 :
relativenumber (more precisely 'hybrid' line numbers) for vim
高级语言: Vim script
项目地址: git://github.com/MahbubAlam231/hybrid-line-numbers.git
创建时间: 2018-07-15T06:48:10Z
项目社区:https://github.com/MahbubAlam231/hybrid-line-numbers

开源协议:GNU General Public License v3.0

下载


hybrid-line-numbers

hybrid-line-numbers shows relative line number for all lines except the current line, for which it shows the absolute line number.
In a buffer with “hybrid” line numbers (:set number relativenumber), NumberToggle switches to absolute line numbers (:set number norelativenumber) automatically when relative numbers don’t make sense.

Relative numbers are used in a buffer that has focus, and is in normal mode, since that’s where you move around. They’re turned off when you switch out of Vim, switch to another split, or when you go into insert mode.

There is a added function (NumberToggle()) using which you can toggle between relative and absolute line numbers if it is useful to you to see absolute line numbers in normal mode sometimes.
Put the following mapping in your .vimrc, it will toggle line numbers—

  1. nnoremap <buffer> <localleader>nt :call NumberToggle()<cr>

You can, of course, change this mapping at your will.

A similar plugin:

A similar plugin is jeffkreeftmeijer/vim-numbertoggle. It doesn’t have the function NumberToggle().

Installation:

Using Vundle

  1. Add Plugin 'MahbubAlam231/hybrid-line-numbers' to ~/.vimrc
  2. Run :PluginInstall

Using vim-plug

  1. Add Plug 'MahbubAlam231/hybrid-line-numbers' to ~/.vimrc or
    ~/.config/nvim/init.vim
  2. Run :PlugInstall
  3. :set number relativenumber