1

I'm currently using the Caps key as ISO_Level3_shift and I'm mapping the h,j,k,l,$ and 0 to vim keys. It works and everything is fine. However, I use SQL and I want to write all the code for SQL in capital letters so it would be hard to press the shift key while typing every letter. So, what I want is someway of using this vim keys as is, but also having the ability to toggle Caps lock when doing some SQL programming. maybe something like holding it for a while or pressing shift+caps to toggle it back.

I'm using XKB to achieve what I'm doing as xmodmap doesn't work for me as I use a second layout which will not work correctly if I use xmodmap.

Here is my /usr/share/X11/xkb/symbols/us file - or at least part of it where I set my current setup:

    key <AC06> {    [     h,    H,  Left        ]   };
    key <AC07> {    [     j,    J,  Down        ]   };
    key <AC08> {    [     k,    K,  Up      ]   };
    key <AC09> {    [     l,    L,  Right       ]   };
    key <AE10> {    [     0,    parenright, Home    ]   };
    key <AE04> {    [     4,    dollar, End     ]   };
    key <CAPS> {    [  ISO_Level3_Shift             ]       };

this portion is inside the

default  partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {}

block

Thanks in advance for your help.

1 Answer 1

0

You can achieve this with one of these commands:

Swap esc with caps: setxkbmap -option caps:swapescape

Shift + caps turn on capslock: setxkbmap -option caps:escape_shifted_capslock

Just run one of them at startup, you can add it to your ~/.xprofile

source: man xkeyboard-config & man setxkbmap

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.