windowsvimcapslockremap

Why is so complicated to remap Esc to CAPS LOCK in Vim?


I saw the vim wiki tips and it says that in order to remap Esc to CAPS LOCK you have to edit the following windows code:

REGEDIT4
[HKEY_CURRENT_USER\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

Is it possible to remap Esc to CAPS LOCK by only adding or modifying lines in the _vimrc?


Solution

  • I recommend that you use AutoHotkey for this.

    You can do a per-application hotkey change:

    SetTitleMatchMode,2
    #IfWinActive,VIM
       CAPSLOCK::ESC
    return
    
    #IfWinActive
       CAPSLOCK::CTRL
    return
    

    This script, for example sets caps to escape in vim, and control everywhere else.