Wednesday, June 16, 2010

Re: numbering lines in groups

> QUESTION: Why does @l<n work and @l<@n fail? Where do I find help?

I guess I answered my own question.
It looks like registers hold only text, but variables can be typed.
Not sure why @b+1 works?

A small improvement, move let lpb=15 out of the map adds the ability
to easily change the number of lines per block.

let lpb=15 "lines per block (zero based)

vmap <F5> :<C-U> let @b=1 <BAR> let @l=0 <BAR>
\ '<,'>s/^/\=printf("( %4d_%X_)",
\ @b + setreg('b', @l<lpb ? @b : @b+1 ),
\ @l + setreg('l', @l<lpb ? @l+1 : 0 ))<cr>
endif

Note: setreg() Returns zero for success
Someone on this list made that suggestion, very clever.
Are there other ways to increment via a map?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: