Re: arbirary regex separator for search ?

2006-09-19 Thread A.J.Mechelynck

Yakov Lerner wrote:

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement
contains many '/', ... then you can avoid backslasing '/' in the
regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/' separator char ?
(It's possible if there's some command name before '/', like in perl,
where m// is synonymous to //).

Yakov



For normal-mode searching, / or ? is both the command and the separator.

In ranges, / or ? similarly define (a) that a search is to take place, 
(b) the direction of the search, and (c) they are repeated as separator 
after the pattern.


The difference with the :s :g and :v commands is that these already 
imply that a forward search is to take place within the command's range.


If you want to do a search without using / or ? you may set the pattern 
first


:let @/ = 'pattern'

and then search for the next occurrence (using n or N ) in the same 
direction as the latest search. In a range you would use \/ or \? to 
reuse the current contents of @/


e.g.
:let @/ = 'pattern1'
:.,\/s+pattern2+text+g

see
:help quote/
:help @/
:help :range


Best regards,
Tony.


Re: arbirary regex separator for search ?

2006-09-19 Thread Tim Chase

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement 
contains many '/', ... then you can avoid backslasing '/' in

the regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/'
separator char ? (It's possible if there's some command name
before '/', like in perl, where m// is synonymous to //).



Not that I know of, but one might be able to hack it with
something like

:let @/='/path/to/file/with/slashes'
:/

which seems to do the trick for me...

-tim






arbirary regex separator for search ?

2006-09-19 Thread Yakov Lerner

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement
contains many '/', ... then you can avoid backslasing '/' in the
regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/' separator char ?
(It's possible if there's some command name before '/', like in perl,
where m// is synonymous to //).

Yakov