# weird behaviour of hlsearch option

3 messages
Open this post in threaded view
|

## weird behaviour of hlsearch option

 May be this is the intended behaviour. But I am finding it a bit intriguing. $cat temp vim vimmers$gvim -u NONE -U NONE temp :set hlsearch /vimmers\|vim Then both the words in the file are completely highlighted. But If I do /vim\|vimmers Then only the vim part of vimmers is higlighted. Logically speaking, both search patterns are same. So :hlsearch should highlight the same area in both the cases. Is this a bug or feature? raju
 Hi, Kamaraju Kusumanchi wrote: > May be this is the intended behaviour. But I am finding it a bit intriguing. > > $cat temp > vim vimmers > >$gvim -u NONE -U NONE temp > > :set hlsearch > > /vimmers\|vim > > Then both the words in the file are completely highlighted. But If I do > > /vim\|vimmers > > Then only the vim part of vimmers is higlighted. Logically speaking, > both search patterns are same. So :hlsearch should highlight the same > area in both the cases. Is this a bug or feature? welld-defined behaviour. From ':help /\|' | */bar* */\bar* */pattern* | 1. A pattern is one or more branches, separated by "\|".  It matches anything |    that matches one of the branches.  Example: "foo\|beep" matches "foo" and |    matches "beep".  If more than one branch matches, the first one is used.                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Regards, J?rgen -- J?rgen Kr?mer                              Softwareentwicklung HABEL GmbH & Co. KG                        mailto:[hidden email] Hinteres ?schle 2                          Tel: +49 / 74 61 / 93 53 - 15 78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99
 On 6/29/05, Jürgen Krämer <[hidden email]> wrote: > > Hi, > > Kamaraju Kusumanchi wrote: > > May be this is the intended behaviour. But I am finding it a bit intriguing. > > > > $cat temp > > vim vimmers > > > >$gvim -u NONE -U NONE temp > > > > :set hlsearch > > > > /vimmers\|vim > > > > Then both the words in the file are completely highlighted. But If I do > > > > /vim\|vimmers > > > > Then only the vim part of vimmers is higlighted. Logically speaking, > > both search patterns are same. So :hlsearch should highlight the same > > area in both the cases. Is this a bug or feature? > > welld-defined behaviour. From ':help /\|' > > |                                               */bar* */\bar* */pattern* > | 1. A pattern is one or more branches, separated by "\|".  It matches anything > |    that matches one of the branches.  Example: "foo\|beep" matches "foo" and > |    matches "beep".  If more than one branch matches, the first one is used. >                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > That pretty much explains it. Thanks for the reply. raju