> Are there other ways to increment via a map?

I didn't understand your problem, the map looks too hard to read, and
has tricky side effect semantics, and this leads to the suggestion
that you use a couple of functions, say, (minimally tested):

let lpb = 4 "lines per block (zero based)
function! Renum()
    let g:b = 1
    let g:l = 0
   '<,'>s/^/\=ResInc()/
endfunction
function! ResInc()
    let result = printf('( %4d_%X_)', g:b, g:l)
    if g:l < g:lpb
        let g:l += 1
    else
        let g:l = 0
        let g:b += 1
    endif
    return result
endfunction

vmap <F4> :<c-u>call Renum()<cr>

A bit pedestrian, I imagine a modern approach would have a function
object, but easy to follow, tweak, and debug, and can have comments
added.  The moral of the story is when maps start getting messy or
long, just make them call a function.

Regards, John

-- 
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

Reply via email to