S&R in visual range

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

S&R in visual range

Eric Leenman-3

Hi,

Many times I have to change

eeee nnnn is
pppp (
 111 : 22  3333;
 999 : 22  3333;
 888 : 44  3333);
end eeee nnnn;

into this:

cccc nnnn
pppp (
 111 : 22  3333;
 999 : 22  3333;
 888 : 44  3333);
end cccc;


in words this is:
- delete in the line: "eeee nnnn is" the is
- delete in the line: "end eeee nnnn;" the nnnn
- replace eeee in the first and last line in cccc

I want to do this by
a) copying
eeee nnnn is
 till
end eeee nnnn;

b) Visual select this and then when the prompt :<',>' appears call a
function by pressing F2.

Is this possible?

Rgds,

Eric Leenman

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

RE: S&R in visual range

Larson, David

> I want to do this by
> a) copying
> eeee nnnn is
>  till
> end eeee nnnn;
>
> b) Visual select this and then when the prompt :<',>' appears call a
> function by pressing F2.
>
> Is this possible?

Why copy the text in step a)? You can accomplish step b) with:

vmap <F2> :call YourFunction()<cr>

HTH,
David

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: S&R in visual range

Ben Schmidt



Larson, David wrote:

>> I want to do this by
>> a) copying
>> eeee nnnn is
>>  till
>> end eeee nnnn;
>>
>> b) Visual select this and then when the prompt :<',>' appears call a
>> function by pressing F2.
>>
>> Is this possible?
>
> Why copy the text in step a)? You can accomplish step b) with:
>
> vmap <F2> :call YourFunction()<cr>

And YourFunction will need to be something like this I think:

function! YourFunction()
   '<s/ is/
   '>s/ nnnn/
   '<s/eeee/cccc
   '>s/eeee/cccc
endfunction



Send instant messages to your online friends http://au.messenger.yahoo.com 


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---