How to replace ~ (tilde) in vim

I have a string with a ~ in it and using the expression



:%s/~/ /g

This doesn't seem to work any ideas?


The symbol ~ matches the previous substitute string (see :help /~), so you need to prefix it with a backslash:

:%s/\~/ /g

You just need to escape it with a backslash:

:%s/\~/ /g


Need to use a backslash for the tilde.

In case anyone else copies a tilde from, e.g., microsoft word, you might also need to search for character 8764 / Hex 223c / Octal 21074 (the ascii tilde is 126/Hex 7e/Octal 176). You can enter that by typing <ctrl-V> u 223c (see for details on entering character codes)

Need Your Help

ASP.NET MVC get textbox input value

c# html razor

I have a textbox input and some radio buttons. For example my textbox input HTML looks like that:

Recognize Disposable Objects in Visual Studio?

c# .net visual-studio intellisense idisposable

It is suggested that IDisposable objects should be disposed in either using statement or by calling Dispose() method. I find it is not intuitive to find out if an object is disposable in Visual Stu...