t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 111 forks source link

German keyboard layout(s) break vim-commands which include brackets #974

Closed dasteihn closed 6 years ago

dasteihn commented 6 years ago

What do I want?

Fix unwanted behavior

Description

I have a bug using the vim-mode-plus package with the normal German Keyboard layout OR the Neo2-Keyboard-Layout which is a special german layout awesomizing programming, as all important coding symbols are on one layer. https://wiki.neo-layout.org/wiki/Tastaturbelegung#Ebene3

However it causes some bugs when using atom.

if(cookie == 1){
        do_awesome_stuff(5);
}

Let's say I wanted to edit the condition of the if, I would type "change inner (" ⇒ ci(

When doing so it causes Atom to delete everything left from the cursor. For example if the cursor was on the second 'o', the vim-mode-edit would create:

okie == 1){
        do_awesome_stuff(5);
}

Or, when using "ci)":

if(co
        do_awesome_stuff(5);
}

I have a hard time understanding this as – from my understanding – the desktop environment pushes the layouted keycodes to the userspace-programs, doesn't it? However one could presume that it's the position of the brackets on the german layout which cause this error and explains why the other commands work. As if Atom would grep the keycodes directly and compare them with the english layout.

As far as I can tell at this point the change-inner-commands are the only vi-commands Atom doesn't execute correctly.

Steps to Reproduce

  1. [Use the German (Neo2) Layout]
  2. [Try to use the vi-command to change the content between two brackets]

Expected behavior: [Delete the content between the brackets and let me type new content]

Actual behavior: [Delete everything left from the cursor when using "ci(", everything right from the cursor when using "ci)", delete the whole line when using "ci[", same with "ci{" and let me type new content]

Reproduces how often: [100% of the time]

Versions

Atom : 1.22.0 Electron : 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0 VMP : 1.20.0

Debian 9 "Stretch", Kernel 4.9, Gnome-Desktop

Check list

You have to check all before open issue.

t9md commented 6 years ago

When you type c i b(it's same behavior with c i (), it work? I thinks it works. If so, your issue is pure keymap issue where ) char is not correctly handled. The responsible module is atom-keymap.

I believe this is duplicate of #661 Does this comment setting solve your issue https://github.com/t9md/atom-vim-mode-plus/issues/661#issuecomment-306305954 ?

dasteihn commented 6 years ago

Yest, it works with cib.

I guess we can close it if vimm+ is not responsible for the problem.

t9md commented 6 years ago

You tried config I linked above, to set altgraph keymap?

dasteihn commented 6 years ago

I tried what you describe here: https://github.com/t9md/atom-vim-mode-plus/issues/661#issuecomment-347004839

It works. Although I'm surprised it makes c i ( work, as typing ( doesn't need the AltGr key.

t9md commented 6 years ago

OK, thanks, then how do you think setting default keymap for AltGr key to avoid similar issue in future? Why I'm asking is I'm not right person to think this issue, since I can't reproduce issue with my keyboard.

dasteihn commented 6 years ago

I don't understand why it has anything to do with the AltGr-key. However the workaround fixes the issue for me.

Can't you install another keyboard-layout? If you use linux desktop environments like Gnome it should be really easy to reproduce the problem.

MaxGyver83 commented 4 years ago

Same problem in Atom 1.45.0 with vim-mode-plus 1.36.4.

When you type c i b(it's same behavior with c i (), it work? I thinks it works.

Yes, it works. But other special characters of level 3 (that's almost all) don't work either in vim commands, for example * or /, and there is no replacement.

If so, your issue is pure keymap issue where ) char is not correctly handled. The responsible module is atom-keymap.

Hard to say which part is responsible. *, /, ( (and all other special characters) work in Atom, except in vim's normal mode (even in vim's insert mode, they work).

I believe this is duplicate of #661 Does this comment setting solve your issue #661 (comment) ?

This doesn't help.