The "Chapter*"-thingy was only meant as an example. The task I want to
do is: repeat overwriting (or may be inserting) charcters with a
previously given character starting from the current cursor position
until a perviously given number of the end-column is reached.


This sounds an awful lot like the description of a "padleft" or "padright" function:


function! PadRight(s, c, len)
    let l:s = a:s
    while strlen(l:s) < a:len
        let l:s = l:s . a:c
        " for a PadLeft function, just use
        " let l:s = a:c . l:s
        " instead
    endwhile
    return l:s
endfunc


which can then be used with

        :%s/.*/\=PadRight(submatch(0), '.', 70)

Or you can even do crazy stuff like

:%s/^\([^:]*\):\s*/\=PadRight(submatch(1), '.', 50)

which will transform text like

Chapter 9: page 20
Chapter 10: page 22

into

Chapter 9.........................................page 20
Chapter 10........................................page 22


(which will put the "page XX" starting at area^Wcharacter 51)

This seems to give you the parameterizability (is that a word?) that you mentioned...wanting to change the character and the count fairly easily.

-tim


Reply via email to