Reputation: 61
I tried to map <Leader> p
(in insert mode) to Ctrl+R "
command in my vimrc. However, as the "
sign is the comment sign for vim, I just can't get it to work
I tried:
inoremap <Leader>p <c-r>"
and
inoremap <Leader>p <c-r>\"
, but both of them don't really give me the register conntent of "
. What can I do to fix this?
Upvotes: 1
Views: 264
Reputation: 7657
From Vim's manual (:help map-comments
):
It is not possible to put a comment after these commands, because the ' " ' character is considered to be part of the {lhs} or {rhs}.
So in your case there is no need to escape the "
character. Thus the first map that you provided:
inoremap <Leader>p <c-r>"
should work. For example, consider the text:
one two three
typing yy
in normal mode will copy the line. Then type A
to go to the end of the line in insert mode. Typing <leader>p
results in:
one two three one two three
If this does not work verify that you are really typing the <leader>
key (use :echo mapleader
to see the leader key). Also check that the contents of the "
register are indeed one two three
(to do this use :register "
).
Upvotes: 3