'Getting YcmCompleter RefactorRename shortcut to work properly

I would like to add shortcut for YcmCompleter RefactorRename command. Here is what I have so far:

nmap <leader>yrn :exe 'YcmCompleter RefactorRename '.input('refactor \"'.expand('<cword>').'\" to:')<cr>"

When I press shortcut, I see input prompt, but after I enter new name, operation fails with RuntimeError: Cannot rename the symbol under cursor.

If I run YcmCompleter RefactorRename newname in the same place, it works just fine. There seems to be a problem with my script

How do I get this to work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source