Search code examples
vimvim-plugin

Using <leader> with :normal


When using :normal how do I simulate typing out the leader key?

I want to do something like:

:normal <leader>J

This is for a plugin I'm writing, so I can't just type out the leader key directly...I need an indirect way to reference it.


Solution

  • As with other special keys, you'll need :exe + "\<keyname>" (double quotes (not single ones) + antislash)

    :exe "normal \<leader>J"