Vim-like movement in any program using Scroll-Lock with letter keys

I reassign some of the keys on my keyboard and want the J, H, L, and K keys to act like the arrow keys when Scroll-Lock is activated, so I can use Vim scroll in any program.

I use xmodmap to reassign some keys, but I did not have the expected behavior with scroll-lock. How can i do this?

+7
vim x11 keymapping scroll-lock
source share
1 answer

This is not quite what you want, but you can write a script that switches the hard xmodmap h, j, k, l to the arrow display.

For example:

 #!/bin/bash if [ `cat /var/layout` == "normal" ]; then xmodmap -e 'keycode 43 = Left' ... echo "hjkl" > /var/layout else xmodmap -e 'keycode 43 = h' ... echo "normal" > /var/layout fi 

(Use xev to search for key codes)

Then you can call it using the global window manager hotkey. Probably all window managers are able to do this more or less well. If you're lucky, you can even bind a scroll lock to it.

+1
source share

All Articles