Turn NumLock On – How to Enable NumLock on Startup

arch linuxnumlockvimxmodmap

I usually edit in Vim,and when pressing +, I'd rather move my hand to the right part of the keyboard where + resides rather than doing shift + =.

But when NumLock is not on, in Vim it just opens a new line above and inserts the letter k. And every time I start my PC NumLock is off.

I would like to know if there is any xmodmap trick to turn on NumLock,so I could add it to my .xinitrc.And it would be even better if I could add it to my .map file which swaps Escape and CapsLock which I load with loadkeys in my /etc/rc.local on startup.

I am using Arch Linux.

Best Answer

There is a package in community numlockx:

# pacman -S numlockx

and then add it to your .xinitrc:

numlockx &

There are also methods on the the Arch Wiki if you are using a login manager, such as GDM or KDM: https://wiki.archlinux.org/index.php/Activating_Numlock_on_Bootup