I pasted text A ∩ B into Vim in order to figure out how the "cap" character is represented.

Using its code, I would then figure out the right commands to print it out from a data analysis environment (specifically, Matlab, though that's not relevant to the question at this point).

The Bash command file ~/tmp/tmp.txt (where the text was pasted) shows that the encoding is UTF-8. So I did some web searching about UTF-8, Unicode, and ASCII.

In Vim, :help :ga says that it prints out the ASCII code. For the "cap" character, it prints <∩> 8745, Hex 2229, Oct 21051, Digr (U. The Hex code is two bytes. From web searching, I'm finding that UTF-8 uses a variable number of bytes, with the first 127 ASCII characters taking up one byte. Since the most significant of 8 bits is for 128+, I assume that 128+ ASCII values take more than one byte because the most significant bit is used as a flag that one more byte is needed for the UTF-8 encoding.

The help for :ga says nothing about Unicode or UTF-8. It says that when a character is larger than 127, the <M-x> form is also printed. Pressing Ctrl+] on <M-x> doesn't warp me to an explanation of what it is. I can't seem to find anything on the internet.

Can someone please point me to an explanation?

P.S. I am not exploring :g8, but I am curious about <M-x>.

1 Answer 1


<M-x> is the notation for Altx on a PC or Optionx on a Mac.

I understand that you would like to enter the ∩ ("cap") character easily, ideally using Altx. I doubt that it is possible.

But maybe a good alternative is the digraph.

The ga commands tells you that you can input it in insert mode it using the sequence:

Ctrlk ( U

Another solution is to use the Unicode code:

Ctrlv u2229

If you want to know the utf8 code of the character you can use the g8 command (that will return for the "cap" character e2 88 a9).

Remark: There is a simple logic that deduce the utf8 code from the Unicode value.

  • 1
    Thanks, Vivian. I found this excursion into Unicode to be very educational. I didn't have to use it, though, nor did I have to use a digraph. I initially anticipated having to specify a code to get the cap character, but as it turns out, I can just paste the string into Matlab string literal and the cap character is preserved. Just a funny observation, I made a typo in saying that "I am not exploring g8". What I meant to say was that I am now exploring g8. Commented Nov 12, 2022 at 6:36
  • Thanks for the feedback ;-) I'm glad we could help you. Commented Nov 12, 2022 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.