How do I search for a special character using the character's code point in vim?
I want to be able to find or replace a character in vi by using 开发者_运维知识库the decimal or hex number for a character. Like character 92 for example.
Is this possible?
To just search for the ASCII character with a hex value of 0x5c (which is 92 in decimal), use the search pattern:
/\%x5c
If you want to search for all occurrences of that character in a file and replace them with another character (or characters), you can enter this command:
:%s/\%x5c/replacement text/gc
You can, of course, replace 5c with the ASCII hex value of whatever character you wish to replace.
I found this information here via a google search for "vim replace ascii character"
精彩评论