Leonard
Leonard

Reputation: 13747

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

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>?

Upvotes: 11

Views: 7552

Answers (3)

Kris Kumler
Kris Kumler

Reputation: 6307

@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).

Upvotes: 0

Christian C. Salvad&#243;
Christian C. Salvad&#243;

Reputation: 827316

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.

Upvotes: 24

Malx
Malx

Reputation: 988

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)

Upvotes: 0

Related Questions