VIM How do I search for a <XX> single byte representation

泪湿孤枕 提交于 2020-07-17 08:03:25

问题


When I cut and paste from a Word document into VIM, quotes get translated into a-circumflex followed by <99>, where the <99> is a single byte representation. (Which I know because when I move to it, typing a single 'l' moves me right to the over all four characters).

I want to do search and replace, and I know enough to find the a-cirumflex digraph using control-K a>, but I can't figure out how to search for the <99>, and searching for the literal /<99> doesn't work.

So I really have two questions:

What help topic should I consult in vim to learn about what sort of a beast the <99> is (since it doesn't seem to be a digraph) (or maybe it IS a digraph and I'm missing something)?

How do I search for a single character represented by <99>?


回答1:


Try this:

Put your cursor over the character, type ga and you will see the hexadecimal representation of the character, then you can replace it with:

:%s/\%xNN//g

Where NN is the hex code of the character.




回答2:


Is'n it relates vim shows question mark instead of character ?

It could be unicode character 0x0099, which has no graphical representation.

How to insert unicode - "u0099 in INSERT mode inserts a character with the unicode value 0x0099." (from here)




回答3:


@CMS detailed searching directly for the character value. If the character is a word by itself (or you can add spaces quickly to make it so), you can also cursor over the character and type ***** -- which will search forward for the closest word to the cursor (# to go backwards).



来源:https://stackoverflow.com/questions/430554/vim-how-do-i-search-for-a-xx-single-byte-representation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!