Skip to content

vim-scripts/vim-vsnumber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4704

vim plugin to make value of number sort in select text,
rargo.m@gmail.com

Usage: use ctrl-v V v to select text,and call vsnumber to make it's value change

for example:
origin text:
		=1--1--3=====9=
		=5--4--6=====9=

select text using ctrl-v( '|' repersents select position):
		=|1--1--3|=====9=
		=|5--4--6|=====9=

if call :'<,'>VsNumber 9 1
the result is:
		=9--10--11=====9=
		=12--13--14=====9=
		that is the number in select text became sort start from 9, increase by 1

if call :'<,'>VsNumber . -1  ("." mean's change uppon on current value)
the result is:
		=0--0--2=====9=
		=4--3--5=====9=
		that is each number in select text sub by 1

It's useful when you has the following text, and you want to correct the suqenuce
	1. line1
	2. line2
	7. line3
	6. line4
to:
	1. line1
	2. line2
	3. line3
	4. line4

also, useful when you want to make a large suqenuce numbers like below:
	enum const_logic {
		int value0 = 0,
		int value1 = 1,
		int value2 = 2,
		int value3 = 3,
		int value4 = 4,
		int value5 = 5,
		int value6 = 6,
		int value7 = 7,
		int value8 = 8,
		int value9 = 9,
		...
	};


About

vim script to make the number sort in selection area

Resources

Stars

Watchers

Forks

Packages

No packages published