vim-renumber


Ⅰ. 插件描述

Renumbering plugin for vim

Ⅱ. 基本信息

创建日期:  2014-01-03
使用用户:  2
Github星:  1
插件作者:  Clarke Retzer

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# renumber.vim

Installation

Using pathogen:

git clone https://github.com/clarke/vim-renumber.git ~/.vim/bundle/renumber

Directly:

# Make sure the vim plugin directory exists
mkdir -p ~/.vim/plugin

# Download the raw plugin
wget -O ~/.vim/plugin/renumber.vim https://raw.github.com/clarke/vim-renumber/master/plugin/renumber.vim

Note: Substitute your vim plugin directory above if you have chosen to use a different location.

Summary

The purpose of this vim plugin is to allow easily reordering of numbered lists. This can be very useful when working with things like Markdown or other numbered lists. For example, say you have a list such as:

ToDo:

1. Take out the trash
2. Put dirty clothes in the wash
3. Go grocery shopping

If you typically purchase trash bags and washing machine soap at the grocery store and realize that you are out of these things so you need to move grocery shopping to the top of the list, you would end up with this list:

3. Go grocery shopping
1. Take out the trash
2. Put dirty clothes in the wash

In the past, I would record a macro using ctrl-a and/or ctrl-x to increment and decrement the numbers, but I found that somewhat tedious. This vim plugin allows you to highlight all rows in a list and run:

call Renumber()

This will reorder the numbers in the list so that they are sequential starting from 1.

TODO

  • Better handling of sub-items

    • Right now, only unordered sub-items will be ignored, but it should really ignore all sub-items including ordered sub-lists.

License

Copyright (c) Clarke Retzer. Distributed under the same terms as Vim itself. See :help license.

添加新评论