-   Linux - Newbie (
-   -   Mapping Esc to windows key in Vim (

frankie_DJ 10-13-2004 07:28 PM

Mapping Esc to windows key in Vim
Is it possible to map a windows key in Vim?
I am trying to use the windows key as Esc to change modes in Vim (Esc is to far up) .
I know I should use

:map <oldkey> <newkey>
but I don't know what is a key code for <windows> key.
When I type

Ctrl-V <windows>
to see the key code for windows key I don't get anything. But then, I don't get anything for <Ctrl> or <Alt> either so I am confused. Thanks for help.

CroMagnon 10-13-2004 11:13 PM

I think the key codes are 115 and 116 for the left and right keys respectively, but could be different on some keyboards. You should be able to check with the xev program.
(Whether or not this will work in vim is something I don't know)

synaptical 10-14-2004 02:56 PM

if you can't get it, you might consider making the caps lock an escape key. just put this in your ~/.xinitrc:

# Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

just make sure caps lock isn't turned off in your xorg.conf. the downside is it only works in X, but for me it's still been useful. :cool:
