Add colemak-jkhl layout to keyboard-layout
This commit remaps the HJKL movement keys to JKHL. See https://colemak.com/ for a description of the colemak layout.
This commit is contained in:
parent
196aeea00c
commit
a8c813a815
|
@ -205,6 +205,23 @@ the [[https://colemak.com/][Colemak website]].
|
|||
- ~k → e~
|
||||
- ~l → i~
|
||||
|
||||
The configuration =colemak-jkhl= reuses HJKL as movement keys, but permuted as
|
||||
JKHL:
|
||||
- ~j~ is now left
|
||||
- ~k~ is now down
|
||||
- ~h~ is now up
|
||||
- ~l~ is right, unchanged
|
||||
|
||||
While not on the home row, the keys are still easily accessible and do not
|
||||
conflict with any other Evil binding.
|
||||
|
||||
Additionally, in normal and motion states, ~L~ is bound to =evil-lookup= while
|
||||
~H~ and ~K~ are respectively bound to =evil-window-top= and
|
||||
=evil-window-bottom=.
|
||||
|
||||
*Note*: for technical reasons (see [[https://github.com/syl20bnr/spacemacs/pull/7178#issuecomment-249360301][GH-7178]]), the =kl/pre-config-evil= and
|
||||
=kl/post-config-evil= hooks will be run /twice/.
|
||||
|
||||
** Workman
|
||||
=Workman= is an English-optimized keyboard layout that's designed to, among
|
||||
other things, reduce finger travel-distance, and balance the load equally
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
;; PUBLIC VARIABLES
|
||||
;;------------------------------------------------------------------------------
|
||||
|
||||
(defvar kl-layout 'dvorak
|
||||
"The keyboard-layout to use. Possible values are `colemak',
|
||||
`dvorak', `bepo', `workman', and `neo'.")
|
||||
(defvar kl-layout 'dvorak)
|
||||
|
||||
(defvar kl-enabled-configurations nil
|
||||
"If non nil, `keyboard-layout' will enable configurations only
|
||||
|
@ -25,8 +23,8 @@ for the passed list of symbols. Configurations that are also in
|
|||
(defvar kl-disabled-configurations nil
|
||||
"If non nil, `keyboard-layout' will disable configurations for
|
||||
the passed list of symbols. This list takes priority over
|
||||
`kl-enabled-configurations', so they will not be loaded in
|
||||
any case.")
|
||||
`kl-enabled-configurations', so they will not be loaded in any
|
||||
case.")
|
||||
|
||||
;;------------------------------------------------------------------------------
|
||||
;; PRIVATE VARIABLES
|
||||
|
@ -85,10 +83,19 @@ any case.")
|
|||
("l" . "s")
|
||||
("j" . "n")
|
||||
("h" . "r")
|
||||
("k" . "t"))))
|
||||
("k" . "t")))
|
||||
(colemak-jkhl . (("j" . "h")
|
||||
("k" . "j")
|
||||
("h" . "k")
|
||||
("l" . "l")
|
||||
;;
|
||||
("h" . "j")
|
||||
("j" . "k")
|
||||
("k" . "h")
|
||||
("l" . "l"))))
|
||||
"The base rebinding map. Dots should be read as `will behave
|
||||
as'. It should be a bidirectional mapping, i.e. all present
|
||||
keys should be once in each column.")
|
||||
as'. It should be a bidirectional mapping, i.e. all present keys
|
||||
should be once in each column.")
|
||||
|
||||
(defvar kl--rebinding-maps
|
||||
(mapcar (lambda (map) `(,(car map) . ,(kl//generate-full-rebinding-map (cdr map))))
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
:dvorak
|
||||
(setq aw-keys '(?a ?o ?e ?u ?h ?t ?n ?s))
|
||||
:neo
|
||||
(setq aw-keys '(?u ?i ?a ?e ?n ?r ?t ?d))))
|
||||
(setq aw-keys '(?u ?i ?a ?e ?n ?r ?t ?d))
|
||||
:colemak-jkhl
|
||||
(setq aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o))))
|
||||
|
||||
(defun keyboard-layout/pre-init-avy ()
|
||||
(kl|config avy
|
||||
|
@ -62,7 +64,9 @@
|
|||
:dvorak
|
||||
(setq-default avy-keys '(?a ?o ?e ?u ?h ?t ?n ?s))
|
||||
:neo
|
||||
(setq-default avy-keys '(?u ?i ?a ?e ?n ?r ?t ?d))))
|
||||
(setq-default avy-keys '(?u ?i ?a ?e ?n ?r ?t ?d))
|
||||
:colemak-jkhl
|
||||
(setq-default avy-keys '(?a ?r ?s ?t ?n ?e ?i ?o))))
|
||||
|
||||
(defun keyboard-layout/pre-init-comint ()
|
||||
(kl|config comint-mode
|
||||
|
@ -146,7 +150,13 @@
|
|||
;; Invert it twice to reset `k' and `K' for searching
|
||||
(dolist (map kl--all-evil-states-but-insert)
|
||||
(kl/correct-keys map
|
||||
"K")))
|
||||
"K"))
|
||||
:colemak-jkhl
|
||||
(progn
|
||||
(define-key evil-motion-state-map "J" 'evil-join)
|
||||
(define-key evil-motion-state-map "K" 'evil-window-bottom)
|
||||
(define-key evil-motion-state-map "H" 'evil-window-top)
|
||||
(define-key evil-motion-state-map "L" 'evil-lookup)))
|
||||
|
||||
(kl|config evil-window
|
||||
:description
|
||||
|
@ -172,6 +182,19 @@
|
|||
"wq" 'delete-window)
|
||||
(kl/leader-alias-of "é" "w"))))
|
||||
|
||||
;; HACK: These are defined by the spacemacs-bootstrap layer, and this is the
|
||||
;; only I've found to make them stick. An unfortunate consequence of using
|
||||
;; `kl|config evil' twice is that user hooks for this configuration will be run
|
||||
;; twice as well.
|
||||
(defun keyboard-layout/post-init-evil ()
|
||||
(kl|config evil
|
||||
:description
|
||||
"Remap `evil' bindings."
|
||||
:colemak-jkhl
|
||||
(progn
|
||||
(define-key evil-normal-state-map "K" nil)
|
||||
(define-key evil-normal-state-map "L" 'spacemacs/evil-smart-doc-lookup))))
|
||||
|
||||
(defun keyboard-layout/pre-init-evil-escape ()
|
||||
(kl|config evil-escape
|
||||
:description
|
||||
|
@ -271,7 +294,12 @@
|
|||
:neo
|
||||
(progn
|
||||
(kl/set-in-state helm-find-files-map "C-r" 'helm-previous-line)
|
||||
(kl/set-in-state helm-find-files-map "C-s" 'helm-next-line)))
|
||||
(kl/set-in-state helm-find-files-map "C-s" 'helm-next-line))
|
||||
:colemak-jkhl
|
||||
(progn
|
||||
;; HACK: Forced to correct wrong behaviour
|
||||
(kl/set-in-state helm-find-files-map "C-h" 'helm-previous-line)
|
||||
(kl/set-in-state helm-find-files-map "C-j" 'helm-find-files-up-one-level)))
|
||||
|
||||
(kl|config helm-locate
|
||||
:description
|
||||
|
@ -297,8 +325,8 @@
|
|||
(spacemacs|use-package-add-hook imenu-list :post-config BODY)
|
||||
:common
|
||||
(kl/evil-correct-keys 'evilified imenu-list-major-mode-map
|
||||
"j"
|
||||
"k")))
|
||||
"j"
|
||||
"k")))
|
||||
|
||||
(defun keyboard-layout/pre-init-ivy ()
|
||||
(kl|config ivy
|
||||
|
@ -355,7 +383,12 @@
|
|||
(progn
|
||||
(magit-change-popup-key 'magit-dispatch-popup :actions ?t ?j)
|
||||
(magit-change-popup-key 'magit-dispatch-popup :actions ?s ?k)
|
||||
(magit-change-popup-key 'magit-dispatch-popup :actions ?S ?K))))
|
||||
(magit-change-popup-key 'magit-dispatch-popup :actions ?S ?K))
|
||||
:colemak-jkhl
|
||||
(progn
|
||||
(kl/evil-correct-keys 'visual magit-mode-map
|
||||
"j"
|
||||
"k"))))
|
||||
|
||||
(defun keyboard-layout/pre-init-mu4e ()
|
||||
(kl|config mu4e
|
||||
|
|
Loading…
Reference in New Issue