Is it normal that kakoune expects me to use its default mapping while in the `map` command?

Hi !

I loved @kkga suggestion (which can be found here) of using :

  • v<a-i>
  • <s-v><a-a>
  • <a-v>v
  • <a-V><s-v>

So I added it to my configuration. Now, that works great and all, no issue.
My problem arise when I tried to center the view after a <c-d>/<c-u>.

Using the following command, map global normal <c-d> <c-d><a-v>v, does not work and only result in the view info menu opening after I have gone a half page down/up.
I have to use the kakoune’s defaults for it to work as expected map global normal <c-d> <c-d>vv.

Is that normal and how it’s supposed to work ? I couldn’t find any reference to this particularity in the mapping documentation.

Yes, this is how it’s supposed to work. In the Kakoune “language”, vv means “scroll the buffer so the main cursor is vertically centred”, and it always means that even if there are custom mappings. That way, scripts and plugins can use vv to centre the cursor without worrying whether the user has remapped those keys to some other thing.

You’re right that this is not clearly mentioned in the mapping documentation. I expected there to be a switch to say “no, really, please call existing mappings” but I was actually thinking of execute-keys -with-maps which is related but nobody learning about mappings would look there.

2 Likes

That way, scripts and plugins can use vv to centre the cursor without worrying whether the user has remapped those keys to some other thing.

Yes, that makes sense. Thank you!

You’re right that this is not clearly mentioned in the mapping documentation.

Might create a pull request to address the issue to be honest, will make newcomer’s life easier :blush:

execute-keys -with-maps

That’s neat!

I beat you to it! :slight_smile:

1 Like