Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use execute "call search('".@a."')" instead.

A bit of context for your question would be good, too.

share|improve this answer
    
Great, thank you! –  dotancohen Sep 20 '12 at 11:35

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.