2048: add vim keys and (hopefully) termux keys!

This commit is contained in:
MitchMarq42 2023-01-15 20:00:26 -09:00
parent 0fbc2fad75
commit 241be55236

View File

@ -381,10 +381,22 @@ individually."
(define-derived-mode 2048-mode fundamental-mode "2048"
"Major mode for playing 2048 in Emacs."
(random t) ;; Start up the RNG
;; Arrow keys
(local-set-key (kbd "<left>") '2048-shift-left)
(local-set-key (kbd "<right>") '2048-shift-right)
(local-set-key (kbd "<down>") '2048-shift-down)
(local-set-key (kbd "<up>") '2048-shift-up)
;; Vim keys
(local-set-key (kbd "h") '2048-shift-left)
(local-set-key (kbd "l") '2048-shift-right)
(local-set-key (kbd "j") '2048-shift-down)
(local-set-key (kbd "k") '2048-shift-up)
;; Swipe controls for termux
(local-set-key (kbd "<mouse-4>") '2048-shift-left)
(local-set-key (kbd "<mouse-5>") '2048-shift-right)
(local-set-key (kbd "<mouse-6>") '2048-shift-down)
(local-set-key (kbd "<mouse-7>") '2048-shift-up)
(2048-startup)
(setq font-lock-defaults '(2048-highlights))
)