Search for text of register in function

Posted by dotancohen on Super User See other posts from Super User or by dotancohen
Published on 2012-09-20T08:57:33Z Indexed on 2012/09/20 9:41 UTC
Read the original article Hit count: 168

Filed under:

I am writing a VIM function which should search for the text found in register a. In VIM I would start a search with / then press Ctrlr and finish off with a then Return. However this line in the function is not working:

execute "/<c-r>a<Return>"

It is throwing this error:

E486: Pattern not found: <c-r>a<Return>

How do I enter the literal Ctrlr into the function? Thanks.

© Super User or respective owner

Related posts about vim