I'd like to have a left and right hand leader key. If I want both the default \ and , to be my leaders I thought it would be as simple as adding nnoremap , \ or nnoremap , <leader> to my .vimrc. But apparently not. How do I do this?
My <leader> is bound to , and this works for me:
:nmap \ ,
All of my leader mappings are now available using either \ or , as the leader. I think it's the nnoremap that's tripping you up.
You can map one leader key to the other, as in the accepted answer, but if you're going to use <leader> in the first place, you should make the binding to <leader> itself. That way the binding will still work if you change (or remove) the first leader key.
map , <leader>
Note that this still doesn't quite work like a second leader. If the first leader is unset, the binding will still work, but Vim will also revert to using \ as a leader, since there is no longer an "official" leader (ie. valid value for the mapleader variable). (This wouldn't be a problem for the OP, but may be for others.)
<leader> is convenient but you can create mappings like ,mm or \mm without using it. Just duplicate all your <leader>something and remap them with ' and \ directly:
nnoremap <leader>d "_d
would become
nnoremap ,d "_d
nnoremap \d "_d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With