At times we might want to use unprintable or other in characters not accessible on our keyboards. For example, if you’d like a search and replace expression to use a carriage return. To enter characters like this in Vim, type
CTRL-v while in insert-mode. Then enter the decimal code. You can also use
CTRL-m for newlines.
While in insert mode press
CTRL-v and then
CTRL-m to insert a newline. Or try
CTRL-V and then
162 to get
¢. The screencast below captures the following substitution to drop each item onto an individual line:
%s/, /,^M /g
Other characters can be inserted using their encoding number,
CTRL-V 13 in the case of carriage return or
CTRL-v 9 can be used to insert a horizontal tab. Here are some other characters you can insert, by typing their number after you’ve pressed
CTRL-v in insert mode:
Here’s a handy list for your reference. Just remember to go into Insert mode, then type
CTRL-v, then type the decimal number.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?