Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Duplicate of superuser.com/questions/683727/…; please don't post in parallel to multiple Stack Exchange sites! –  Ingo Karkat Dec 4 '13 at 8:28

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.