![]() In fact wherever you press the ESC key (such as to exit insert mode), you could equivalently press Ctrl+ [ instead, that would work. You might have noticed that using Ctrl+ [ after the Ctrl+ V is also possible, that's because Ctrl+ [ is the same as ESC. Also, when moving the cursor around, it will only stop on top of the ^ and not the [, to be consistent with that being a single character. It will be displayed as ^[, but usually in a different color, to indicate it's representing a single character. ![]() So using Ctrl+ V, ESC is one way to enter this sequence. In Vim, it's usually possible to insert a literal character by preceding it with the Ctrl+ V combination. So this will also work: :s/\e\*m//gįinally, as you noticed, it's possible to insert a literal ESC character in your match. Since ESC is a somewhat frequently used symbol, there is a special shortcut escape sequence for it: \e. The following works on Vim: :s/\%x1b\*m//gīut you can simplify it. Vim doesn't recognize \xNN C-style sequences, but it actually does recognize similar sequences with a slightly different syntax: \%xNN, so one way you can translate that ESC sequence to \%x1b. The C-style \xNN sequence recognized by sed takes the hexadecimal representation of the character, which in the case of ESC is 1B, so that's where \x1b comes from. ![]() See the manpage for ascii(7): Oct Dec Hex Char The \x1b escape sequence (which works in sed, also C source code and shells like bash) corresponds to an ESC (like the ESC key.)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |