Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to swap the Caps Lock and Escape keys? [SOLVED]

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
endived
Posts: 38
Joined: 2011-06-28 05:21
Location: Hong Kong
Has thanked: 1 time

How to swap the Caps Lock and Escape keys? [SOLVED]

#1 Post by endived »

I'm finally familiar enough with vim to start coding with it.
I have an excellent (standard American) Model M keyboard, but the problem is that the Escape key is a little out of reach, which interrupts me constantly.
There is the obvious Ctrl-[ but it seems my head doesn't work that way.
I could remap the keys in .vimrc, but then I'd like to remap the keys in the vi-mode of my bash prompt also.

I figure that the best thing for me is to swap the Escape and CAPS LOCK keys. Not just in X (if I use X, I use XFCE) but in the console also.

What is the best way to do this? I've come across a number of solutions on the internet, but I guess the best place to ask about this is here.

What I've tried so far:
* dumpkeys to backup.kmap, edit this file to swap keycode 1 and 58, save as blabla.kmap, and loadkeys blabla.kmap. No change in keyboard behaviour.
* edit /etc/default/keyboard so that it contains XKBOPTIONS="caps:swapescape". Then run dpkg-reconfigure console-setup. No change either.

Thanks.

I'm running Debian Wheezy.
Last edited by endived on 2012-07-24 15:14, edited 1 time in total.
Never kill a customer.

Quantum
Posts: 1458
Joined: 2006-03-21 19:06
Location: Seattle, Ecotopia

Re: How to swap the Caps Lock and Escape keys?

#2 Post by Quantum »

See if this helps.

endived
Posts: 38
Joined: 2011-06-28 05:21
Location: Hong Kong
Has thanked: 1 time

Re: How to swap the Caps Lock and Escape keys?

#3 Post by endived »

Quantum wrote:See if this helps.
Thanks.

But no cigar. :(

Have tried on a Wheezy and also a Lenny box. There's no /etc/console directory and I tried to locate boottime.kmap.gz but it didn't come up with any result.
Never kill a customer.

Quantum
Posts: 1458
Joined: 2006-03-21 19:06
Location: Seattle, Ecotopia

Re: How to swap the Caps Lock and Escape keys?

#4 Post by Quantum »

Oh? I have /etc/console with boottime.kmap.gz in it. Current Debian Testing.

endived
Posts: 38
Joined: 2011-06-28 05:21
Location: Hong Kong
Has thanked: 1 time

Re: How to swap the Caps Lock and Escape keys?

#5 Post by endived »

Quantum wrote:Oh? I have /etc/console with boottime.kmap.gz in it. Current Debian Testing.
This is a little weird. I checked on a couple of machines, but I don't have this directory or that keymap file on any of them.
Never kill a customer.

User avatar
debil
Posts: 1336
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: How to swap the Caps Lock and Escape keys?

#6 Post by debil »

endived wrote:There's no /etc/console directory and I tried to locate boottime.kmap.gz but it didn't come up with any result.
The directory comes in console-common package. I'd think console-data has something to do with this as well. Anyways, I have these installed and the following inside /etc/default/keyboard:

Code: Select all

XKBMODEL="pc105"
XKBLAYOUT="fi"
XKBVARIANT=""
XKBOPTIONS="ctrl:nocaps"
I have a separate setxkbmap line inside my ~/.xinitrc as well. Works as expected. Swapping capslock with esc should (sic) work too, in theory at least.
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.

who_
Posts: 15
Joined: 2012-07-24 07:35

Re: How to swap the Caps Lock and Escape keys?

#7 Post by who_ »

Cool! This is just what I was looking for. Thanks!

endived
Posts: 38
Joined: 2011-06-28 05:21
Location: Hong Kong
Has thanked: 1 time

Re: How to swap the Caps Lock and Escape keys?

#8 Post by endived »

debil wrote:
endived wrote:There's no /etc/console directory and I tried to locate boottime.kmap.gz but it didn't come up with any result.
The directory comes in console-common package. I'd think console-data has something to do with this as well. Anyways, I have these installed and the following inside /etc/default/keyboard:

Code: Select all

XKBMODEL="pc105"
XKBLAYOUT="fi"
XKBVARIANT=""
XKBOPTIONS="ctrl:nocaps"
I have a separate setxkbmap line inside my ~/.xinitrc as well. Works as expected. Swapping capslock with esc should (sic) work too, in theory at least.
I installed console-common and console-data and instead of "ctrl:nocaps" I went for "caps:swapescape".
Now it does indeed work. :)

Thanks for your help.
Never kill a customer.

Post Reply