Use the normal
command:
command EasyMotion normal <Leader><Leader>w
Question
For this example, I would like the custom :EasyMotion
command to have the same effect as <Leader><Leader>w
in normal mode. To achieve this, I have tried adding the following to my vimrc.
command EasyMotion <Leader><Leader>w
This does not work. Using this command causes the error E10: \ should be followed by /, ? or & to appear.
I understand why this is -- as this answer to a similar question explains, my :EasyMotion
command is equivalent to :\\w
, which is not valid. But how do I get around this? How do I write a custom command that uses a feature that can only be used normal mode?
Solution
Use the normal
command:
command EasyMotion normal <Leader><Leader>w