1

Using gvim on Microsoft Windows, I find myself unable to use some control keys.

For example I cannot navigate the :help topics using Control+]. Likewise, I cannot escape insert mode using Control+[.

Do anyone know the reason for this behaviour and an possible way to have force the right behaviour?

Edit: the issue seems related to the use of the "United Kingdom (extended)" keyboard layout.

  • 1
    It seems to work for me in Windows. I installed Vim from the vim homepage, and used the default config. – Martin Tournoij May 6 '15 at 10:11
  • Do you have a non-English keyboard layout? Does this also happen in a plain gvim -N -u NONE? – Ingo Karkat May 6 '15 at 10:40
  • @ingo I'm using an extended english keyboard (UK). Using the given options the keys do work as intended. – M'vy May 6 '15 at 10:45
  • Then you may have a mapping interfering. Check with :verbose map <C-[> and :verbose map <C-]> (when those don't work). – Ingo Karkat May 6 '15 at 10:56
  • 1
    @Ingo Oh my bad. It seems that's it's the keyboard problem. The gvim -N -u NONE does not change the problem (my keyboard must have change inadvertently to the normal UK I guess when I tested). – M'vy May 6 '15 at 11:19
1

I can reproduce this; and the problem seems to be that this keyboard layout doesn't send any characters on <C-[>, <C-]>, <C-#>, and <C-\>.

I managed to figure this out (and more importantly: fix it) by using the Microsoft Keyboard Layout Creator, or MSKLC for short. You'll need to download & install it.

Here's the normal UK layout:

enter image description here

And here's the Extenxed UK layout:

enter image description here

Notice the [, ], #, and \ are blank?

Now, to fix this, I did:

  • Go to "File -> Load existing keyboard".
  • Choose "United Kingdom Extended"
  • Check the "Ctrl" checkbox on the left, and click on each of the problematic keys; filling in the values below that I copied from the UK keyboard layout (you need to click 'Advanced view' before you get to see the Ctrl+<key> field in the popup dialog):

    • [ -> U+001b, scan code 1a
    • ] -> U+001d, scan code 1b
    • # -> U+001c, scan code 2b (this is above the enter key)
    • \ -> U+001c, scan code 56 (this is between the Z and left shift)

After this, I saved the "source file" (not required, I think), and went to "Project -> Build DLL an setup package" to make a setup.exe; after running this I have my "UK Extended (custom)" layout.
Strangely, this shows up as "Welsh", and not 'English', but does seem to work. But after removing and adding it again from the control panel, it does show up as Enlish...

Be aware that Windows has a Left-shift+Left Alt shortcut to switch keyboard layouts, which is very ease to accidentally use. And I've also experienced some special magic-fu method to automatically switch keyboard layout depending on the locale off the application. To minimize the confusion, I've always found it best to remove all keyboard layouts except the ones you really need (you can always re-add them later) (SU also has some info, for example here).

Disclaimer: I only tested this with my US-international keyboard, as I don't own a UK keyboard. But I believe this should fix your problem :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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