In the command-line mode or in a vimscript I can use the following to duplicate a line:
normal! Yp
Now let's says that I map my leader key to do that: nnoremap <Leader>a Yp
. If I use this key combination the following command will interpret litterally the characters or <leader>
:
normal! <Leader>a
How can I use a key combination including <leader>
in a normal command?
Note that other keys like <Right>
or <F3>
doesn't work neither.
Edit Some side notes:
- Using
normal
ornormal!
doesn't seem to change something to the problem - The point of the question is to be able to use
<Leader>
and not replace it by its value for two 2 reasons:- It is more portable if I use it in a script and want to distribute it.
- My leader is
<Space>
so even if I replace<Leader>
by its value I still have the same problem. (Note that I could maybe escape a space character but that is not the point of the question)
normal
instead ofnormal!
. My leader is\
, and I can usenormal \a
to execute the mapping, but I don't know how to keep it generic wrt leader.<leader>
by its value is not really what I'm looking for.