How to replace ~ (tilde) in vim
I have a string with a ~ in it and using the expression
hi~how~are~you :%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:
You just need to escape it with a backslash:
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 http://vim.wikia.com/wiki/Entering_special_characters for details on entering character codes)