Home » Questions » Computers [ Ask a new question ]

Remap keys for one specific program under Linux

Remap keys for one specific program under Linux

How can I set keys to be remapped for one specific program in Linux? (More specifically Caps Lock -> Escape for gVim. I hit it accidentally too much to remap it in everything).

Asked by: Guest | Views: 105
Total answers/comments: 2
Guest [Entry]

"Check Vim's wiki on wikia.com.

If you want to completely swap the
Caps Lock and Escape keys, you have to
replace the ""Lock"" on Caps Lock. Drop
this file in your home directory:

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

and call it "".speedswapper"". Then open
a terminal and type

$ xmodmap .speedswapper

The swapping lasts for the duration of
the X session, so you can put it in a
.xinitrc or similar startup file.

There are some other interesting alternative ESC mappings as well."
Guest [Entry]

you can write a simple bash script which can run the above mentioned solution whenever you run vim and remove the file after you close vlc.