Re: seaching for selected multiline expression

2006-07-14 Thread J.Hofmann
  Gary Johnson wrote:
  I just recently enhanced it to work with multi-line patterns.
 
 vmap silent g/ y/C-R=substitute(escape(@, '\\/.*$^~[]'), '\n',
'\\n', 'g')CRCR

Works, Thank You.

concatenating substitute() and escape() seems to be tricky.

Joachim
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/


seaching for selected multiline expression

2006-07-13 Thread J.Hofmann
Hello,

I have a mapping which immediately searches for visually selected items.
It achieves this by yanking the selected text and exec[utes] a search for
the register content 
This works so far.

  vmap / y:execute /.escape(@,'[]/\.*')CR

Now I tried this first time for multiline selects, but it does not work:
Selecting this:

USE ICCS_2005
GO

leads to:
- E486: Pattern not found: USE [EMAIL PROTECTED]@  

To surround the error, I shortened the abbreviation to
   vmap / y:execute /.@CR,
this causes the same error message.

What is ^@ ?
How can I have \n instead of thes ^@ - characters to make the search work?

Thank You

Joachim
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/


Re: seaching for selected multiline expression

2006-07-13 Thread Benji Fisher
On Thu, Jul 13, 2006 at 06:02:40PM +0200, [EMAIL PROTECTED] wrote:
 Hello,
 
 I have a mapping which immediately searches for visually selected items.
 It achieves this by yanking the selected text and exec[utes] a search for
 the register content 
 This works so far.
 
   vmap / y:execute /.escape(@,'[]/\.*')CR
 
 Now I tried this first time for multiline selects, but it does not work:
 Selecting this:
 
 USE ICCS_2005
 GO
 
 leads to:
 - E486: Pattern not found: USE [EMAIL PROTECTED]@  
 
 To surround the error, I shortened the abbreviation to
vmap / y:execute /.@CR,
 this causes the same error message.
 
 What is ^@ ?
 How can I have \n instead of thes ^@ - characters to make the search work?
 
 Thank You
 
 Joachim

:execute / . substitute(@, \C-J, '\\n', 'g')

or

:execute / . substitute(@, \n, '\\n', 'g')

:help NL-used-for-Nul

HTH --Benji Fisher


Re: seaching for selected multiline expression

2006-07-13 Thread Gary Johnson
On 2006-07-13, [EMAIL PROTECTED] wrote:
 Hello,
 
 I have a mapping which immediately searches for visually selected items.
 It achieves this by yanking the selected text and exec[utes] a search for
 the register content 
 This works so far.
 
   vmap / y:execute /.escape(@,'[]/\.*')CR
 
 Now I tried this first time for multiline selects, but it does not work:
 Selecting this:
 
 USE ICCS_2005
 GO
 
 leads to:
 - E486: Pattern not found: USE [EMAIL PROTECTED]@  

 How can I have \n instead of thes ^@ - characters to make the search work?

Someone posted a similar mapping to this list some time ago and I 
just recently enhanced it to work with multi-line patterns.

vmap silent g/ y/C-R=substitute(escape(@, '\\/.*$^~[]'), '\n', '\\n', 
'g')CRCR

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA