History
Article Edit this page Discussion

Remap the Escape key

From Vim Tips Wiki

(Redirected from VimTip342)
Jump to: navigation, search

Tip 342 Previous Next Created: October 11, 2002 Complexity: intermediate Author: mrts Version: 6.0


Tired of hunting down <Esc> at upper-left of your keyboard, while using a keyboard with useless Windows keys?

Well, remap them -- use xmodmap. I'm using Debian and my xmodmap config file is in /etc/X11/xinit/xmodmap. You may have to use xmodmap directly (from ~/.xinitrc in *BSD or whatever).

Here's part of my xmodmap:

keycode 115 = braceleft
keycode 116 = Escape
keycode 117 = braceright

The keys are:

  • 115 - Windows key, between the left-hand Ctrl and Alt keys
  • 116 - Windows key, to the right of the AltGr key
  • 117 - Menu key, to the left of the right-hand Ctrl key

Valid for all environments with X, on *BSD as well as on Linux.

You get the same mappings under ordinary console by modifying the console keymap file (pretty self-explanatory), in my case it's /usr/share/keymaps/i386/qwerty/et.kmap.gz.

I'm using mapping braces to winkeys because of my Estonian keyboard.

[edit] Comments

I think users with german, slavic (and probably some other) keyboards will have better things to do with the windows key - because we need additional keys for umlauts etc, or other language-specific letters, some of the important signs, namely {[]}\ are the "third-function" of number keys 7 and above. You have to type those with the right hand, while simultaneously pressing "Alt Ctr" located right of the spacebar which at least I never learned to do properly, you can't do that without changing the position of the hand, and I keep hitting the wrong key. I've been raging about this stupid mapping for a long time without it ever occurring to me that there's a free key you could map to Alt Ctr and use it with your left hand.


Why don't you map

  • left winkey -> {
  • shift+left winkey -> [
  • right winkey -> <Esc>
  • right winmenu -> }
  • shift+right winmenu ]

Ctrl+[ is already mapped to escape.


> Is there a way to remap capslock for the console, too?

Yes, if you are using KDE3. Just go into the control panel under keyboard and choose to make the CapsLock another control key. Then you can use capslock-[ the way it was originally intended to be used in Vim.


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Remap the Escape key"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation