0

From my .vimrc:

nmap s <Plug>(easymotion-overwin-f)

This sets up an nmap which invokes the EasyMotion plugin when I type ,s.

And that nmap works just fine, and is indeed triggered by ,s.

However, if I do :nmap ,s or :nmap <Leader>s nvim prints "No mapping found."

Why?

EDIT

Some output from :filter /easy/ nmap:

filter

2
  • 1
    You are mapping nmap s and querying maps via :nmap ,s. Those are not the same mappings. Maybe you can do :filter /easy/ nmap to find your mapping Apr 30, 2018 at 19:04
  • @PeterRincker but s is not the mapping. I believe that easymotion-overwin-f takes the argument s and creates the mapping <Leader>s which in my case is ,s. In any case, one way or another ,s gets setup as the mapping... so I don't see why it wouldn't be listed. I've edited the OP with the output from :filter /easy/ nmap.
    – Jonah
    Apr 30, 2018 at 19:12

1 Answer 1

2

However, if I do :nmap ,s or :nmap s nvim prints "No mapping found."

Why?

:map (and variants) will return the mappings that Vim/NeoVim is currently using. In your setup you have:

nmap ,, <Plug>(easymotion-prefix)

There are a few more that easymotion looks to map. Specifically ones that look like:

<Plug>(easymotion-prefix)N <Plug>(easymotion-N)
<Plug>(easymotion-prefix)n <Plug>(easymotion-n)
<Plug>(easymotion-prefix)j <Plug>(easymotion-j)
" So on and so forth

None of the mappings you have a * ahead of the Right-hand-side. See :h map-listing. This means the mappings will trigger other mappings (aka recursive mappings). This mean you can trigger <Plug>(easymotion-N) via <Plug>(easymotion-prefix)N which is also equivalent to ,,N. There is no ,,N mapping, but due to the maps being recursive and chording <Plug>(easymotion-N) can still be executed.

So when you execute, ,,s the ,, maps to <Plug>(easymotion-prefix) then waits for another possible letter to find another mapping. In this case a s. When the s is pressed it expands fully to <Plug>(easymotion-s).

For more help see:

:h mapping
:h map-listing
:h :filter
3
  • Thanks Peter. That all makes sense. At the end of the day, I wanted to check if ,s was free before I used it for something else. It is not free. However, as your post demonstrates, I cannot rely on nmap ,s to determine that (since it falsely reports that it is free). Is there any method by which I can determine if a mapping is actually free?
    – Jonah
    Apr 30, 2018 at 20:03
  • 1
    Easy motion is relying on recursive mappings to simplify customization. It really feels like they are trying to create a new mode. Typically most mappings will use noremap and this will not be an issue. Sadly, this type of mapping will always be annoying to chase down. The best I can say is you can use <nowait> to force a mapping if you want. See :h :map-nowait. This also highlights one of the reasons some Vimmers are wary of plugins. Apr 30, 2018 at 20:11
  • Thanks again. I certainly share those reservations about anything that makes debugging difficult. That said, EasyMotion is so damn useful that I'll put up with it in this case.
    – Jonah
    Apr 30, 2018 at 20:15

Your Answer

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

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