Adding colemak keyboard layout option to `keyboard-layout`

- Base Remapping Keys

`#{n, e, i, o}` <=> `#{h, j, k, l}`

- setting `avy` keys to the `colemak` home row keys

`#{a, r, s, t, n, e, i, o}`

- adjusting leader key to `tn`

- overriding evil org mode bindings especially for 'o'

- one character key guess rebindings can give back empty string
when looking for the prefix and it isn't empty, then guess the rebindings --
this fix lets the check not pass and return `'(nil nil)`, allowing the
`(remove-if #'null)` to actually work.

- correcting magit staging when using visual line
This commit is contained in:
Daniel Mijares 2017-02-21 16:15:51 -05:00 committed by syl20bnr
parent 7554affd49
commit 4461721e2a
5 changed files with 52 additions and 10 deletions

View File

@ -12,6 +12,8 @@
- [[#keyboard-layouts][Keyboard layouts]]
- [[#bepo][bepo]]
- [[#dvorak][dvorak]]
- [[#colemak][colemak]]
- [[#remapped-keys][Remapped Keys]]
- [[#package-configurations][Package Configurations]]
- [[#keybindings][Keybindings]]
- [[#sources][Sources]]
@ -148,6 +150,16 @@ will remap keybindings for the =dvorak-programmer= variant.
[[file:img/dvorak-keymap.png]]
** colemak
=colemak= is a keyboard layout designed for touch typing in English.
[[file:img/colemak-layout.png]]
*** Remapped Keys
- ~avy~ and ~ace-window~ keys are remapped to the ~colemak~ home row
- ~evil-leader~ is also remapped to ~tn~
* Package Configurations
The available configurations are:

View File

@ -14,7 +14,7 @@
;;------------------------------------------------------------------------------
(defvar kl-layout 'dvorak
"The keyboard-layout to use. Possible values are `dvorak' and `bepo'.")
"The keyboard-layout to use. Possible values are `colemak', `dvorak' and `bepo'.")
(defvar kl-enabled-configurations nil
"If non nil, `keyboard-layout' will enable configurations only
@ -41,6 +41,15 @@ any case.")
("j" . "t")
("k" . "s")
("l" . "c")))
(colemak . (("n" . "h")
("e" . "j")
("i" . "k")
("o" . "l")
;;
("h" . "n")
("j" . "e")
("k" . "i")
("l" . "o")))
(dvorak . (("h" . "h")
("t" . "j")
("n" . "k")

View File

@ -27,7 +27,7 @@
(mapcar
(lambda (modifier)
(cons (concat modifier key1) (concat modifier key2)))
'("" "C-" "M-" "C-S-")))))
'("C-" "M-" "C-S-")))))
basemap))
(defun kl//define-key (maps key def bindings)
@ -81,7 +81,8 @@ key."
(let* ((key2 (cdr (assoc key1 rebinding-map)))
(bind1 (assoc key1 rebinding-map))
(bind2 (assoc key2 rebinding-map)))
(when prefix
(when (and prefix
(not (string-empty-p prefix)))
(defun kl//guess-prefixit (bind)
`(,(concat prefix (car bind)) . ,(concat prefix (cdr bind))))
(setq bind1 (kl//guess-prefixit bind1))

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -42,6 +42,8 @@
(spacemacs|use-package-add-hook ace-window :post-init BODY)
:bepo
(setq aw-keys '(?a ?u ?i ?e ?t ?s ?r ?n))
:colemak
(setq aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o))
:dvorak
(setq aw-keys '(?a ?o ?e ?u ?h ?t ?n ?s))))
@ -53,6 +55,8 @@
(spacemacs|use-package-add-hook avy :post-init BODY)
:bepo
(setq-default avy-keys '(?a ?u ?i ?e ?t ?s ?r ?n))
:colemak
(setq-default avy-keys '(?a ?r ?s ?t ?n ?e ?i ?o))
:dvorak
(setq-default avy-keys '(?a ?o ?e ?u ?h ?t ?n ?s))))
@ -171,7 +175,9 @@
:loader
(spacemacs|use-package-add-hook evil-escape :post-init BODY)
:bepo
(setq-default evil-escape-key-sequence "gq")))
(setq-default evil-escape-key-sequence "gq")
:colemak
(setq-default evil-escape-key-sequence "tn")))
(defun keyboard-layout/pre-init-evil-evilified-state ()
(kl|config evil-evilified-state
@ -308,11 +314,14 @@
(spacemacs|use-package-add-hook magit :post-config BODY)
:common
(progn
(kl/evil-correct-keys evil-magit-state magit-mode-map
"j"
"k"
"C-j"
"C-k")
(dolist (state (if evil-magit-use-y-for-yank
(list evil-magit-state 'visual)
(list evil-magit-state)))
(kl/evil-correct-keys state magit-mode-map
"j"
"k"
"C-j"
"C-k"))
(kl/evil-correct-keys 'normal evil-magit-toggle-text-minor-mode-map
"C-j")
(dolist (map (list magit-branch-section-map
@ -436,7 +445,18 @@
"gk" nil
;; additional
(kbd "«") 'org-metaleft
(kbd "»") 'org-metaright))))
(kbd "»") 'org-metaright))
:colemak
(progn
(spacemacs|use-package-add-hook evil-org
:post-config
(progn
(evil-define-key 'normal evil-org-mode-map
"O" 'org-forward-heading-same-level
"o" 'evil-forward-char
"E" 'org-forward-element
"I" 'org-backward-element
"N" 'org-backward-heading-same-level))))))
(defun keyboard-layout/pre-init-org-agenda ()
(kl|config org-agenda