On Thu, Mar 12, at 12:42 parekh wrote:
>
> Hi,
>
> I have something like this -
> reg a0 = abc[0]
> reg a0 = abc[0]
> reg a0 = abc[0]
> reg a0 = abc[0]
>
> I am trying to create something like this -
> reg a0 = abc[0]
> reg a1 = abc[1]
> reg a2 = abc[2]
> reg a3 = abc[3]
>
> Any recommendations on how I can do this at a command line?
Here is a possible way:
Source this function,
function! Increm() range
let nr = 1
let line = a:firstline + 1
while line <= a:lastline
let string = getline(line)
call setline(line, substitute(string, '[[:digit:]]\+', nr, 'g'))
let nr += 1
let line += 1
endwhile
endfunction
:1,4 call Increm()
or while selecting the lines
:'<,'>call Increm()
> TIA
> Sanjay
Regards,
Ag.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---