Exact string match in vim? (Like 'regex-off' mode in less.)

前端 未结 3 1894
悲&欢浪女
悲&欢浪女 2020-12-09 07:49

In vim, I often want to search on a string with finicky characters which need escaping. Is there a way I can turn off the meaning of all special characters, kind of

3条回答
  •  醉话见心
    2020-12-09 08:20

    Maybe something like this:

    nmap s :execute '/\V' . escape(input('/'), '\\/')
    

    It'll give you a / prompt and behave otherwise like the built-in search, but it won't do search-as-you-type or other such goodies.

提交回复
热议问题