search

Home  >  Q&A  >  body text

How to map esc to caps lock in vim?

Actually, I mainly don’t know how to express the cap key. For example, esc is <ESC>

PHPzPHPz2774 days ago1175

reply all(4)I'll reply

  • 滿天的星座

    滿天的星座2017-05-16 16:44:27

    I searched around and came back, but there is no way to express Caps Lock (see link below):

    http://stackoverflow.com/questions/21...

    You can choose the method provided on the page

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 16:44:27

    Usually, you need to re-modify the keyboard mapping in the system, or you can buy a HHKB

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:44:27

    Because vim can’t capture CapsLock~
    Generally speaking, this exchange is at the OS level
    Under Windows, use remapkey and GUI drag and drop. The backend will automatically change the registry. Once the changes are completed, log out and it will take effect
    Under linux, use the configuration file by changing the xmodmap command. And xmodmap is not valid under the Linux text interface (tty1-6)... I heard that the kernel mapping needs to be changed, but I don't know.

    reply
    0
  • 阿神

    阿神2017-05-16 16:44:27

    用AutoHotkey,脚本如下:

    classname = ""
    keystate = ""

    *Capslock::
    WinGetClass, classname, A
    if (classname = "Vim")
    {
    SetCapsLockState, Off
    Send, {ESC}
    }
    else
    {
    GetKeyState, keystate, CapsLock, T
    if (keystate = "D")
    SetCapsLockState, Off
    else
    SetCapsLockState, On
    return
    }
    return

    reply
    0
  • Cancelreply