neovide: can't map

Describe the bug can’t map <ctrl+shift+v> in any mode, the behavior is normar only nvim.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Neovide Version 0.11.2
  • Neovim Version v0.9.2

Please run neovide --log and paste the contents of the .log file created in the current directory here:

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 32 (26 by maintainers)

Most upvoted comments

@JamesWidman, can you try my PR first?

Including shift like you suggest would only work for standard ascii alphas and break for all mappings involving special characters. You should not need to include shift in your mappings, since that’s keyboard layout dependent. For example the following does not trigger the mappings:

:map <C-%> <cmd>echo "hello"<cr>
:call feedkeys("\<C-S-%>")

And there are a few standard mappings with the potential to break like <C-^> and <C-\><C-N>, depending on the keyboard layout.

Always including shift has also caused problems previously https://github.com/neovide/neovide/pull/1547 (I found out when doing more research while making my fix)

Finally, another reason I don’t like to use shift in the mappings is that from the perspective of Neovide the following mappings are all different 5, <S-5>, %, <S-%>, if you use just 5 and %, there’s no ambiguity, and that’s also the approach Vim itself took and including other modifiers should be no different.

I mean, maybe i’ll have to fixup my cmd+shift mappings when a future version of neovim comes out, but i’m ok with that, and making neovide drop shift from cmd + shift combos isn’t going to solve neovim’s issue.

No, not with my PR, you won’t have to change your mappings in the future, as long as you map your CMD mappings like this, <D-A>. When the Neovim bug is fixed you will additionally be able to use the alternative forms <D-S-A> and even <D-S-a>, which means that everything stays compatible no matter which GUI you are using. Note that the equivalence is only true for ascii alpha characters, special characters should always be mapped without shift using the resulting character.

And that makes it totally consistent with how ALT/META mappings work inside Neovim already.

CTRL mappings are different due to legacy reasons. For ascii alphas <C-a> and <C-A>'> both means unshifted characters, while <C-S-A>and<C-S-a>`, means shifted characters. That’s the only confusing part here, and without that we could say: “never use shift in your mappings”. That’s still true for the non-ascii characters or non-alphas.

So, the final rule is the following: Never use shift in your mappings, unless the mapping contains CTRL and an ascii alphabetic character together.

@JamesWidman, the original PR did this https://github.com/neovide/neovide/pull/1979/files. So that’s another option for doing it,

But I think I prefer a single option like you are suggesting. If you could add boolean true/false support for backwards compatibility that sets “Both/None” respectively, then it would be even better.

Yes, I think doing it the same way as ime_enabled is fine.

i could give it a try (though we might want a neovide contributor who is also a mac user to review the PR)

Thanks, that would be nice. We do have several people that are able to at least test on mac. But everyone being able to write code has been busy.

BTW, I think this is the message, which led me to the implementation there is right now https://github.com/neovide/neovide/pull/1899#issuecomment-1595656852