I am trying to paste a string from a register in VIM which contains non-ASCII characters such as Ctrlr, how can I paste this string into a file, but escape the non-ASCII characters automatically?

Essentially, what I am trying to achieve is recording a macro which has some (non-ascii) characters, such as CtrlW which vim will show as ^W. I want to be able to take the macro (by examining the registers and taking the macro string (i.e @a=^W)) and copying it into a .vimrc file as a key-map, so that when I press the key it will run that macro.

I want to do this automatically (or as fast as possible) without having to change ^W into CtrlW in the .vimrc file, or wherever I paste it too.


1 Answer 1


CTRL-V allows you to insert non-ASCII characters into VIM.

i.e. to insert CTRL-W you need to press CTRL-V CTRL-W.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .