Search code examples
searchvimtilde

Search for ~ (tilde) in vim


How can I search for a ~ (tilde) in vim?

I tried /\~ and / \~ as /~ does not work.

Thanks for your help!


Solution

  • /\~ works here. (with magic as default)

    There are other ways,

    • you can search by character class: /[~]
    • you can search in nomagic mode /\M~
    • you can search in very nomagic mode /\V~