I need to replace ^Q, ^S and ^U in a text file with Ubuntu. These are ctrl+Q and not carat+Q . Since ^Q is a control key command, I cannot type that in and carat+Q does not work. Is there anyway to type in ^Q ^S and ^U
There's an escape sequence for this.
For ^Q type Ctrl+V Ctrl+Q. On some system you have to type the code for it, eg: Ctrl+V 017.
An alternative to using Ctrl-V is to use digraphs. A digraph is a two-character representation of a Unicode value, which can include control characters. By default the digraph for ^Q
is D1
, ^S
is D3
and ^U
is NK
. To enter a digraph in insert mode press Ctrl-K followed by the digraph, eg to enter use <Ctrl-K>D1
.
The docs say you can also set the 'digraph' option and enter a digraph by pressing first character, backspace, second character. This does not appear to work for all control characters though.
You can use digraphs to enter a wide range of Unicode characters, and can redefine existing ones or define new ones. Type :digraph
to get a full list of currently defined digraphs and :h digraphs
to see the full help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.