I want to replace a character with its hex literal. For example before regex:
I'm trying this:
But this replaces it with
What am I doing wrong? Is this even possible?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
In that way,
printf expects a decimal number to be converted to a hexadecimal one. All you need to do is convert the character to a number as follows:
:help char2nr() for details.