On Thu, Nov 23, 2006 at 11:59:59AM -0500, Jean-Rene David wrote:
> * Meino Christian Cramer [2006.11.23 02:45]:
> >  I want to search a longer string totally
> >  literally...regexp totally switched of, no
> >  exceptions.
> 
> function! LiteralSearch(string) range
>    let l:pattern = escape(a:string, '\\/.*$^~[]')
>    let @/ = l:pattern
>    normal n
> endfunction
> 
> :command -nargs=1 LS call LiteralSearch (<f-args>)
> 
> Then:
> 
> :LS .*$
> 
> Will match one time in this message, in the
> function code above instead of matching every
> line.
> 
> Map as desired.

     Another option is

/\V<pat>

For example,

/\V.*$^~[]

works on this e-mail.  This is not so effective as the solution above:
you still have to escape / (if you start the search with it) and \ .

:help /\V

HTH                                     --Benji Fisher

Reply via email to