renumber.vim


Ⅰ. 插件描述

Egads! It's *another* renumber utility :-)

Ⅱ. 基本信息

创建日期:  2002-01-23
使用用户:  2
Github星:  4
插件作者:  Neil Bird

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

This would seem to be very similar in function to Inc (vimscript #156) - I put it here mainly for posterity.

The main differences are that it will honour preceeding zeros (without assuming octal ... plus, 0 in hex numbers are honoured: "0x0001"), and it will 'tidy up' misaligned numbers, to a degree (only right-aligns ATM). It uses the location of the first number to determine the alignment location.

You may now renumber starting at the /bottom/ of a block with the 'r' (reverse) option.  Note that you still have a default increment of +1, so to renumber a block ending at '10' you need to change the last number in the file to "10", make your selection and "Renumber r s-1".

Renumber will also renumber days & months (e.g., Jan,Feb.Mar, etc.).  To renumber days, use the 'd' argument - for months, it's 'm'.

Use by selecting the block of text (visually, linewise or blockwise, etc.), then issuing:

:'<,'>Renumber

.. or some other range indicator.

Renumber will search the selection for a number (left -> right), and use that (hence use blockwise selection (<Ctrl-V>) to specify a column).  It will only edit numbers it finds in subsequent lines that have approximately the same position within each line.

You may pass in any arguments in any order:

a  - consider whole of line when searching for next number (even blockwise).
d - renumber with day names
m - renumber with month names
r - reverse block order: start renumbering from bottom of block upwards
sN  - [no space] use increment N (may be negative).

Eg.,

:'<,'>Renumber a
:'<,'>Renumber s4
:'<,'>Renumber a s-2
:'<,'>Renumber m s3
:'<,'>Renumber r s-1

Todo - add a left-justify option (probably '-').

添加新评论