2

I'm trying to use a leader mapping in another mapping. But nothing happens when I attempt to use the second mapping. I'm quite sure I've done this before. What's going wrong?

This mapping finds the next sentence, roughly speaking, as expected:

:noremap <leader>se /\v>[.;:?!](\s<bar>$)<CR>  

I want to use that mapping in another, but nothing happens - as in, for example:

noremap <leader>sb \se

1 Answer 1

3

You're using the noremap command, which doesn't expand mappings on the expansion, so it won't recognize the \se which is a mapping itself.

See :help :nore, which says:

Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often used to redefine a command.

In your case, you want the regular version of the :map command, to be able to recognize mappings in the replacement. So you can fix this with:

:map <leader>sb \se

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.