Emacs: Bind Number Pad Keys
See that large useless number pad on your keyboard? It's your best friend. It adds 17 programable keys!
Note: On the Mac, defining keys for the numeric keypad will not work. You need to use a keymap tool first to make them send numpad key signals. 〔see Mac: Keyboard Software Guide〕
If you run emacs in terminal, numberpad may not work.
To use, be sure the number lock is on.
Bind Number Pad Keys
;; number pad keys ;; syntax for Emacs 29 and later (keymap-global-set "<kp-decimal>" 'other-window) (keymap-global-set "<kp-0>" 'delete-window) (keymap-global-set "<kp-1>" 'delete-other-windows) (keymap-global-set "<kp-2>" 'split-window-below) (keymap-global-set "<kp-3>" 'xah-open-file-at-cursor) (keymap-global-set "<kp-subtract>" 'xah-close-current-buffer) (keymap-global-set "<kp-divide>" 'xah-previous-user-buffer) (keymap-global-set "<kp-multiply>" 'xah-next-user-buffer) ;; s------------------------------ ;; syntax for Emacs 28 or before (global-set-key (kbd "<kp-decimal>") 'other-window) (global-set-key (kbd "<kp-0>") 'delete-window) (global-set-key (kbd "<kp-1>") 'delete-other-windows) (global-set-key (kbd "<kp-2>") 'split-window-below) (global-set-key (kbd "<kp-3>") 'xah-open-file-at-cursor) (global-set-key (kbd "<kp-subtract>") 'xah-close-current-buffer) (global-set-key (kbd "<kp-divide>") 'xah-previous-user-buffer) (global-set-key (kbd "<kp-multiply>") 'xah-next-user-buffer)
You can also use the numberpad keys for outside of emacs. See: