With reference to my HP-41 filetype plugin (script id=1361).

Renumbering is awfully sloooow. Unusable in fact when renumbering more
than 50 lines and increasing rapidly beyond that :-(

I have the following type of list that I want to renumber quite often:

001 *LBL "DATA"
002  SF 27
003  CF 00
004  CF 01
005  SF 02
006  SF 25
007  0
008  SEEKPTA
009  FC?C 25

(it's the start of an HP-41 FOCAL program)

So the format of the numbering to be renumbered every once in a while is:

"^\d\d\d "

The code for renumbering:

if !exists("*s:Renumber")
    function Renumber()
        let s:linenumber = line(".")
        let s:colnumber = col(".")
        call cursor(1,1)
        normal 0cw001
        while search("^\d\d\d ", "W") > 0
            execute "normal 3cl\<c-y>\<c-y>\<c-y>\<esc>\<c-a>"
        endwhile
        call cursor(s:linenumber,s:colnumber)
    endfunction
endif

Calling the function:

imap  <M-+> <ESC>:call Renumber()<CR>a
map  <M-+> :call Renumber()<CR>

and making sure the numbers are not treated like octals:

set nrformats-=octal

Could you see a more speedy way of doing this (I bet)?


->Geir Isene :)

-- 
Daglig leder / CEO FreeCode AS
Cell:  +47 - 473 44 000
Phone: +47 - 21 53 69 00, Fax: +47 - 21 53 69 09
Addr:  Nydalsveien 30b, 0484 Oslo
Web:   http://www.freecode.no/

Want faster communications? Send me your message as a WOIM-list:
http://www.isene.com/artweb.cgi?article=012-woim.txt

Attachment: signature.asc
Description: Digital signature

Reply via email to