Unicode escape is ctrl+[ , why does this work in terminal or vim, but not safari or other parts of OS?

Solution 1:

For example if search a page in safari you can't escape out of the search with ctrl+[

It's because Safari is not operating in an ASCII/ANSI Terminal environment.

The Escape character is

  • octal: \033
  • hexadecimal: \x1B or ^[
  • decimal: 27

It's just a series of characters the terminal looks for that interprets it as actions or special characters.

As for working in vim (or vi), you aren't limited to sending ^[ (^ Control[), you can simply press the Escape key. It will do the same thing.