numbers.vim


Ⅰ. 插件描述

plugin for intelligently toggling line numbers.

Ⅱ. 基本信息

创建日期:  2014-11-05
使用用户:  2
Github星:  1
插件作者:  Benedykt Przybyło

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/numbers-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/numbers-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/numbers-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/numbers.vim

Ⅳ. 文档说明

numbers.vim

Github: https://github.com/b3niup/numbers.vim

numbers.vim is a plugin for intelligently toggling line numbers.  
It is a fork of @myusuf3 plugin.

This plugin alternates between relative (relativenumber), absolute (number)  
and hidden line numbering for active window depending on the mode you are in.

In hidden mode all event-based mode changes are turned off to keep numbers  
hidden untill next NumbersToggle or NumbersEnable call.

Commands are included for toggling the line numbering method and for enabling and disabling the plugin.

Hiding numbers in plugins and files

If you would like to hide numbers in vim plugins or in files with specified filetype you can set custom g:numbers_exclude list in your .vimrc:

    let g:numbers_exclude = ['nerdtree', 'html']

This example will hide numbers in NERD Tree and all html files.

By default plugin excludes following filetypes:

    let g:numbers_exclude = ['minibufexpl', 'nerdtree', 'unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m']

Be sure to include this superset in your .vimrc if you only would like to extend it.

Usage

Once installed, no action is required on your part.  
But for convenience, you may want to add mappings in your .vimrc for some of the commands, e.g.,

    nnoremap <silent> <F2> :NumbersToggle<CR>

It is though strongly recommended to use following mapping:

    inoremap <C-c> <Esc><Esc>

It is a workaround for issue where InsertLeave event is not working with Ctrl+c.  
Another way to fix this is add autocmd CursorMoved * :call NumbersReset() in NumbersEnable() function  
around line 104 in plugin/numbers.vim, but personally I do not like idea of calling even such light function with every cursor move.

添加新评论