The special character ^[
is actually Esc.
If you want to include it in a regex you can type it using the following key sequence:
Ctrl vEsc
In general in presence of a special character you can discover its code using the ga
command. Move the cursor on the character and hit ga
.
The output gives you:
- The decimal code (
27
in case of Esc) - The hexadecimal code (
1b
in case of Esc) - The digraph if any (
EC
in case of Esc)
You can use that information to reinsert the same character in insert mode:
- Ctrl v
027
- Ctrl v
x1b
- Ctrl k
EC