Merge pull request #3966 from gagbo/fix/bepo-evil-enhancements

:input layout bepo enhancements
This commit is contained in:
Henrik Lissner 2020-10-04 16:36:46 -04:00 committed by GitHub
commit 87b6a1fa46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 240 additions and 224 deletions

View file

@ -68,9 +68,10 @@
(:after geiser-doc :map geiser-doc-mode-map (:after geiser-doc :map geiser-doc-mode-map
:n "o" #'link-hint-open-link) :n "o" #'link-hint-open-link)
(:unless (featurep! :input layout +bepo)
(:after (evil-org evil-easymotion) (:after (evil-org evil-easymotion)
:map evil-org-mode-map :map evil-org-mode-map
:m "gsh" #'+org/goto-visible) :m "gsh" #'+org/goto-visible))
(:when (featurep! :editor multiple-cursors) (:when (featurep! :editor multiple-cursors)
:prefix "gz" :prefix "gz"

View file

@ -14,14 +14,9 @@
(set-face-attribute 'nobreak-space nil :underline t) (set-face-attribute 'nobreak-space nil :underline t)
(add-transient-hook! 'doom-init-modules-hook (add-transient-hook! 'doom-init-modules-hook
;; "ts" would be a little too common for an evil escape sequence
(setq evil-escape-key-sequence "gq")
(setq avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n) (setq avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n)
lispy-avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n ?m ?b ?p ?o ?v ?d ?l ?j ?z) lispy-avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n ?m ?b ?p ?o ?v ?d ?l ?j ?z))
evil-markdown-movement-bindings '((up . "s")
(down . "t")
(left . "c")
(right . "r")))
;; :ui window-select settings, ignoring +numbers flag for now ;; :ui window-select settings, ignoring +numbers flag for now
(after! ace-window (after! ace-window
(setq aw-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n))) (setq aw-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n)))
@ -29,21 +24,6 @@
(setq switch-window-shortcut-style 'qwerty (setq switch-window-shortcut-style 'qwerty
switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r"))) switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r")))
(doom-bepo-rotate-ts-bare-keymap '(read-expression-map))
(doom-bepo-rotate-bare-keymap '(evil-window-map) doom-bepo-cr-rotation-style)
(map! :i "C-t" #'+default-newline
(:when (featurep! :editor multiple-cursors)
:prefix "gz"
:nv "t" #'evil-mc-make-cursor-move-next-line
:nv "s" #'evil-mc-make-cursor-move-prev-line
;; the old toggle mapping (t) is made available both on "T" for mnemonics and
;; "j" as a "classic" rotation
:nv "T" #'+multiple-cursors/evil-mc-toggle-cursors
:nv "j" #'+multiple-cursors/evil-mc-toggle-cursors)
(:when (featurep! :ui popup)
:n "C-$" #'+popup/toggle
:n "C-#" #'+popup/raise))
(map! (map!
:leader :leader
:desc "Window" "é" 'evil-window-map :desc "Window" "é" 'evil-window-map
@ -67,7 +47,36 @@
:desc "Jump to next hunk" ")" #'git-gutter:next-hunk :desc "Jump to next hunk" ")" #'git-gutter:next-hunk
:desc "Jump to previous hunk" "(" #'git-gutter:previous-hunk)) :desc "Jump to previous hunk" "(" #'git-gutter:previous-hunk))
(:prefix-map ("p" . "project") (:prefix-map ("p" . "project")
:desc "Browse other project" "»" #'doom/browse-in-other-project)) :desc "Browse other project" "»" #'doom/browse-in-other-project)))
(when (featurep! :editor evil)
(add-transient-hook! 'doom-init-modules-hook
;; "ts" would be a little too common for an evil escape sequence
(setq evil-escape-key-sequence "gq")
(setq evil-markdown-movement-bindings '((up . "s")
(down . "t")
(left . "c")
(right . "r"))
evil-org-movement-bindings '((up . "s")
(down . "t")
(left . "c")
(right . "r")))
(doom-bepo-rotate-ts-bare-keymap '(read-expression-map))
(doom-bepo-rotate-bare-keymap '(evil-window-map) doom-bepo-cr-rotation-style)
(doom-bepo-rotate-evil-keymap doom-bepo-cr-rotation-style)
(map! :i "C-t" #'+default-newline
(:when (featurep! :editor multiple-cursors)
:prefix "gz"
:nv "t" #'evil-mc-make-cursor-move-next-line
:nv "s" #'evil-mc-make-cursor-move-prev-line
;; the old toggle mapping (t) is made available both on "T" for mnemonics and
;; "j" as a "classic" rotation
:nv "T" #'+multiple-cursors/evil-mc-toggle-cursors
:nv "j" #'+multiple-cursors/evil-mc-toggle-cursors)
(:when (featurep! :ui popup)
:n "C-$" #'+popup/toggle
:n "C-#" #'+popup/raise))
(after! treemacs (after! treemacs
(doom-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map))) (doom-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map)))
(after! (:or helm ivy) (after! (:or helm ivy)
@ -87,8 +96,6 @@
(doom-bepo-rotate-bare-keymap '(helm-rg-map) doom-bepo-cr-rotation-style)) (doom-bepo-rotate-bare-keymap '(helm-rg-map) doom-bepo-cr-rotation-style))
(after! helm-files (after! helm-files
(doom-bepo-rotate-bare-keymap '(helm-read-file-map) doom-bepo-cr-rotation-style)) (doom-bepo-rotate-bare-keymap '(helm-read-file-map) doom-bepo-cr-rotation-style))
(after! general
(doom-bepo-rotate-evil-keymap doom-bepo-cr-rotation-style))
(after! company (after! company
(doom-bepo-rotate-bare-keymap '(company-active-map company-search-map) doom-bepo-cr-rotation-style)) (doom-bepo-rotate-bare-keymap '(company-active-map company-search-map) doom-bepo-cr-rotation-style))
(after! evil-snipe (after! evil-snipe
@ -117,6 +124,9 @@
(kbd "C-h !"))) (kbd "C-h !")))
'org-time-stamp-inactive) 'org-time-stamp-inactive)
(apply #'completing-read args)))) (apply #'completing-read args))))
(after! (evil org evil-org-agenda)
(doom-bepo-rotate-bare-keymap '(org-agenda-keymap) doom-bepo-cr-rotation-style)
(doom-bepo--evil-collection-hook nil '(evil-org-agenda-mode-map)))
(after! (evil magit evil-magit) (after! (evil magit evil-magit)
(doom-bepo-rotate-ts-bare-keymap (doom-bepo-rotate-ts-bare-keymap
'(magit-mode-map '(magit-mode-map
@ -143,4 +153,4 @@
magit-process-mode-map magit-process-mode-map
magit-refs-mode-map))) magit-refs-mode-map)))
(after! evil-easymotion (after! evil-easymotion
(doom-bepo-rotate-bare-keymap '(evilem-map) doom-bepo-cr-rotation-style))) (doom-bepo-rotate-bare-keymap '(evilem-map) doom-bepo-cr-rotation-style))))

View file

@ -19,7 +19,7 @@
- [[#how-to-deactivate-the-new-bindings-and-go-back-to-the-old-ones-][How to deactivate the new bindings and go back to the old ones ?]] - [[#how-to-deactivate-the-new-bindings-and-go-back-to-the-old-ones-][How to deactivate the new bindings and go back to the old ones ?]]
* Description * Description
This module provides barebones support for using Doom with evil-mode with non-qwerty layouts. This module provides barebones support for using Doom with non-qwerty layouts.
** Maintainers ** Maintainers
+ @gagbo (Author) + @gagbo (Author)
@ -31,8 +31,10 @@ This module provides barebones support for using Doom with evil-mode with non-qw
None None
* Prerequisites * Prerequisites
This module should only be active if evil is enabled. It uses a general.el utility function, and If you are using =:editor evil=, you should use =(evil +everywhere)=, as the
the hooks provided by evil-collection to make the necessary changes. module uses =evil-collection= utilities to do the remapping.
If you are not using =:editor evil=, then you have nothing to do.
* Features * Features
# An in-depth list of features, how to use them, and their dependencies. # An in-depth list of features, how to use them, and their dependencies.
@ -68,6 +70,9 @@ A nice addition in the future might be to have all the normal mode bindings that
start with =g= start with =,= instead to avoid the curl on these common start with =g= start with =,= instead to avoid the curl on these common
bindings. This is *not* implemented for the time being. bindings. This is *not* implemented for the time being.
Also, implementing all those changes as a minor we could flip on and off would
help with adoption
* Configuration * Configuration
** Bépo ** Bépo
=doom-bepo-cr-rotation-style= controls whether: =doom-bepo-cr-rotation-style= controls whether:

View file

@ -4,7 +4,7 @@
(defun doom-bepo-rotate-ts-bare-keymap (keymaps) (defun doom-bepo-rotate-ts-bare-keymap (keymaps)
"Rotate [jk] with [ts] in KEYMAP." "Rotate [jk] with [ts] in KEYMAP."
(dolist (keymap keymaps) (dolist (keymap keymaps)
(general-translate-key nil keymap (evil-collection-translate-key nil keymap
"t" "j" "t" "j"
"T" "J" "T" "J"
"s" "k" "s" "k"
@ -13,44 +13,44 @@
"J" "T" "J" "T"
"k" "s" "k" "s"
"K" "S" "K" "S"
"C-t" "C-j" (kbd "C-t") (kbd "C-j")
"C-s" "C-k" (kbd "C-s") (kbd "C-k")
"C-j" "C-t" (kbd "C-j") (kbd "C-t")
"C-k" "C-s" (kbd "C-k") (kbd "C-s")
"M-t" "M-j" (kbd "M-t") (kbd "M-j")
"M-s" "M-k" (kbd "M-s") (kbd "M-k")
"M-j" "M-t" (kbd "M-j") (kbd "M-t")
"M-k" "M-s" (kbd "M-k") (kbd "M-s")
"C-S-t" "C-S-j" (kbd "C-S-t") (kbd "C-S-j")
"C-S-s" "C-S-k" (kbd "C-S-s") (kbd "C-S-k")
"C-S-j" "C-S-t" (kbd "C-S-j") (kbd "C-S-t")
"C-S-k" "C-S-s" (kbd "C-S-k") (kbd "C-S-s")
"M-S-t" "M-S-j" (kbd "M-S-t") (kbd "M-S-j")
"M-S-s" "M-S-k" (kbd "M-S-s") (kbd "M-S-k")
"M-S-j" "M-S-t" (kbd "M-S-j") (kbd "M-S-t")
"M-S-k" "M-S-s"))) (kbd "M-S-k") (kbd "M-S-s"))))
;;;###autoload ;;;###autoload
(defun doom-bepo-rotate-é-quotes-bare-keymap (keymaps) (defun doom-bepo-rotate-é-quotes-bare-keymap (keymaps)
"Rotate [w<>] with [é«»] in KEYMAP." "Rotate [w<>] with [é«»] in KEYMAP."
(dolist (keymap keymaps) (dolist (keymap keymaps)
(general-translate-key nil keymap (evil-collection-translate-key nil keymap
"é" "w" "é" "w"
"É" "W" "É" "W"
"«" "<" "«" "<"
"»" ">" "»" ">"
"C-é" "C-w" (kbd "C-é") (kbd "C-w")
"C-«" "C-<" (kbd "C-«") (kbd "C-<")
"C-»" "C->" (kbd "C-»") (kbd "C->")
"M-é" "M-w" (kbd "M-é") (kbd "M-w")
"M-«" "M-<" (kbd "M-«") (kbd "M-<")
"M-»" "M->" (kbd "M-»") (kbd "M->")
"C-S-é" "C-S-w" (kbd "C-S-é") (kbd "C-S-w")
"C-S-«" "C-S-<" (kbd "C-S-«") (kbd "C-S-<")
"C-S-»" "C-S->" (kbd "C-S-»") (kbd "C-S->")
"M-S-é" "M-S-w" (kbd "M-S-é") (kbd "M-S-w")
"M-S-«" "M-S-<" (kbd "M-S-«") (kbd "M-S-<")
"M-S-»" "M-S->"))) (kbd "M-S-»") (kbd "M-S->"))))
;;;###autoload ;;;###autoload
(defun doom-bepo-rotate-cr-bare-keymap (keymaps &optional style) (defun doom-bepo-rotate-cr-bare-keymap (keymaps &optional style)
@ -62,47 +62,47 @@ Undefined behaviour in other cases, for forward compatibility."
(let ((style (or style 'ergodis))) (let ((style (or style 'ergodis)))
(dolist (keymap keymaps) (dolist (keymap keymaps)
(progn (progn
(general-translate-key nil keymap (evil-collection-translate-key nil keymap
"c" "h" "c" "h"
"C" "H" "C" "H"
"r" "l" "r" "l"
"R" "L" "R" "L"
"C-c" "C-h" (kbd "C-c") (kbd "C-h")
"C-r" "C-l" (kbd "C-r") (kbd "C-l")
"M-c" "M-h" (kbd "M-c") (kbd "M-h")
"M-r" "M-l" (kbd "M-r") (kbd "M-l")
"C-S-c" "C-S-h" (kbd "C-S-c") (kbd "C-S-h")
"C-S-r" "C-S-l" (kbd "C-S-r") (kbd "C-S-l")
"M-S-c" "M-S-h" (kbd "M-S-c") (kbd "M-S-h")
"M-S-r" "M-S-l") (kbd "M-S-r") (kbd "M-S-l"))
(cond ((eq style 'ergodis) (cond ((eq style 'ergodis)
(general-translate-key nil keymap (evil-collection-translate-key nil keymap
"h" "r" "h" "r"
"H" "R" "H" "R"
"l" "c" "l" "c"
"L" "C" "L" "C"
"C-h" "C-r" (kbd "C-h") (kbd "C-r")
"C-l" "C-c" (kbd "C-l") (kbd "C-c")
"M-h" "M-r" (kbd "M-h") (kbd "M-r")
"M-l" "M-c" (kbd "M-l") (kbd "M-c")
"C-S-h" "C-S-r" (kbd "C-S-h") (kbd "C-S-r")
"C-S-l" "C-S-c" (kbd "C-S-l") (kbd "C-S-c")
"M-S-h" "M-S-r" (kbd "M-S-h") (kbd "M-S-r")
"M-S-l" "M-S-c")) (kbd "M-S-l") (kbd "M-S-c")))
(t (t
(general-translate-key nil keymap (evil-collection-translate-key nil keymap
"h" "c" "h" "c"
"H" "C" "H" "C"
"l" "r" "l" "r"
"L" "R" "L" "R"
"C-h" "C-c" (kbd "C-h") (kbd "C-c")
"C-l" "C-r" (kbd "C-l") (kbd "C-r")
"M-h" "M-c" (kbd "M-h") (kbd "M-c")
"M-l" "M-r" (kbd "M-l") (kbd "M-r")
"C-S-h" "C-S-c" (kbd "C-S-h") (kbd "C-S-c")
"C-S-l" "C-S-r" (kbd "C-S-l") (kbd "C-S-r")
"M-S-h" "M-S-c" (kbd "M-S-h") (kbd "M-S-c")
"M-S-l" "M-S-r"))))))) (kbd "M-S-l") (kbd "M-S-r"))))))))
;;;###autoload ;;;###autoload
(defun doom-bepo-rotate-bare-keymap (keymaps &optional cr-style) (defun doom-bepo-rotate-bare-keymap (keymaps &optional cr-style)
@ -117,7 +117,7 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE"
"Remap evil-{normal,operator,motion,...}-state-map "Remap evil-{normal,operator,motion,...}-state-map
to be more natural with Bépo keyboard layout. to be more natural with Bépo keyboard layout.
See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE." See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
(general-translate-key nil '(normal motion visual) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map)
"c" "h" "c" "h"
"C" "H" "C" "H"
"t" "j" "t" "j"
@ -131,62 +131,62 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
"k" "s" "k" "s"
"K" "S") "K" "S")
(cond ((eq cr-style 'ergodis) (cond ((eq cr-style 'ergodis)
(general-translate-key nil '(normal motion visual) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map)
"h" "r" "h" "r"
"H" "R" "H" "R"
"l" "c" "l" "c"
"L" "C")) "L" "C"))
(t (t
(general-translate-key nil '(normal motion visual) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map)
"h" "c" "h" "c"
"H" "C" "H" "C"
"l" "r" "l" "r"
"L" "R"))) "L" "R")))
(general-translate-key nil '(insert) (evil-collection-translate-key nil '(evil-insert-state-map)
"C-c" "C-h" (kbd "C-c") (kbd "C-h")
"C-C" "C-H" (kbd "C-C") (kbd "C-H")
"C-t" "C-j" (kbd "C-t") (kbd "C-j")
"C-T" "C-J" (kbd "C-T") (kbd "C-J")
"C-s" "C-k" (kbd "C-s") (kbd "C-k")
"C-S" "C-K" (kbd "C-S") (kbd "C-K")
"C-r" "C-l" (kbd "C-r") (kbd "C-l")
"C-R" "C-L" (kbd "C-R") (kbd "C-L")
"C-j" "C-t" (kbd "C-j") (kbd "C-t")
"C-J" "C-T" (kbd "C-J") (kbd "C-T")
"C-k" "C-s" (kbd "C-k") (kbd "C-s")
"C-K" "C-S") (kbd "C-K") (kbd "C-S"))
(cond ((eq cr-style 'ergodis) (cond ((eq cr-style 'ergodis)
(general-translate-key nil '(insert) (evil-collection-translate-key nil '(evil-insert-state-map)
"C-h" "C-r" (kbd "C-h") (kbd "C-r")
"C-H" "C-R" (kbd "C-H") (kbd "C-R")
"C-l" "C-c" (kbd "C-l") (kbd "C-c")
"C-L" "C-C")) (kbd "C-L") (kbd "C-C")))
(t (t
(general-translate-key nil '(insert) (evil-collection-translate-key nil '(evil-insert-state-map)
"C-h" "C-c" (kbd "C-h") (kbd "C-c")
"C-H" "C-C" (kbd "C-H") (kbd "C-C")
"C-l" "C-r" (kbd "C-l") (kbd "C-r")
"C-L" "C-R"))) (kbd "C-L") (kbd "C-R"))))
;; <> as direct access ;; <> as direct access
(general-translate-key nil '(normal motion) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map)
"«" "<" "«" "<"
"»" ">") "»" ">")
;; " è replaces ^0 to go at BOL ;; " è replaces ^0 to go at BOL
(general-translate-key nil '(normal motion) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map)
"è" "^" "è" "^"
"È" "0") "È" "0")
;; [W] -> [É] ;; [W] -> [É]
;; [C-W] -> [W] ;; [C-W] -> [W]
(general-translate-key nil '(normal motion operator) (evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
"é" "w" "é" "w"
"É" "W" "É" "W"
"w" "C-w" "w" (kbd "C-w")
"W" "C-w C-w")) "W" (kbd "C-w C-w")))
;;;###autoload ;;;###autoload
(defun doom-bepo-rotate-collection-keymaps-h-builder (cr-style) (defun doom-bepo-rotate-collection-keymaps-h-builder (cr-style)
@ -195,7 +195,7 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
(let* ((cr-style (or cr-style 'ergodis)) (let* ((cr-style (or cr-style 'ergodis))
(doom-bepo-hook (lambda (_mode mode-keymaps &rest _rest) (doom-bepo-hook (lambda (_mode mode-keymaps &rest _rest)
(dolist (keymap mode-keymaps) (dolist (keymap mode-keymaps)
(general-translate-key '(normal motion visual) keymap (evil-collection-translate-key '(normal motion visual) keymap
"c" "h" "c" "h"
"C" "H" "C" "H"
"t" "j" "t" "j"
@ -209,60 +209,60 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
"k" "s" "k" "s"
"K" "S") "K" "S")
(cond ((eq cr-style 'ergodis) (cond ((eq cr-style 'ergodis)
(general-translate-key '(normal motion visual) keymap (evil-collection-translate-key '(normal motion visual) keymap
"h" "r" "h" "r"
"H" "R" "H" "R"
"l" "c" "l" "c"
"L" "C")) "L" "C"))
(t (t
(general-translate-key '(normal motion visual) keymap (evil-collection-translate-key '(normal motion visual) keymap
"h" "c" "h" "c"
"H" "C" "H" "C"
"l" "r" "l" "r"
"L" "R"))) "L" "R")))
(general-translate-key '(insert) keymap (evil-collection-translate-key '(insert) keymap
"C-c" "C-h" (kbd "C-c") (kbd "C-h")
"C-C" "C-H" (kbd "C-C") (kbd "C-H")
"C-t" "C-j" (kbd "C-t") (kbd "C-j")
"C-T" "C-J" (kbd "C-T") (kbd "C-J")
"C-s" "C-k" (kbd "C-s") (kbd "C-k")
"C-S" "C-K" (kbd "C-S") (kbd "C-K")
"C-r" "C-l" (kbd "C-r") (kbd "C-l")
"C-R" "C-L" (kbd "C-R") (kbd "C-L")
"C-j" "C-t" (kbd "C-j") (kbd "C-t")
"C-J" "C-T" (kbd "C-J") (kbd "C-T")
"C-k" "C-s" (kbd "C-k") (kbd "C-s")
"C-K" "C-S") (kbd "C-K") (kbd "C-S"))
(cond ((eq cr-style 'ergodis) (cond ((eq cr-style 'ergodis)
(general-translate-key '(insert) keymap (evil-collection-translate-key '(insert) keymap
"C-h" "C-r" (kbd "C-h") (kbd "C-r")
"C-H" "C-R" (kbd "C-H") (kbd "C-R")
"C-l" "C-c" (kbd "C-l") (kbd "C-c")
"C-L" "C-C")) (kbd "C-L") (kbd "C-C")))
(t (t
(general-translate-key '(insert) keymap (evil-collection-translate-key '(insert) keymap
"C-h" "C-c" (kbd "C-h") (kbd "C-c")
"C-H" "C-C" (kbd "C-H") (kbd "C-C")
"C-l" "C-r" (kbd "C-l") (kbd "C-r")
"C-L" "C-R"))) (kbd "C-L") (kbd "C-R"))))
;; <> en direct ;; <> en direct
(general-translate-key '(normal motion visual) keymap (evil-collection-translate-key '(normal motion visual) keymap
"«" "<" "«" "<"
"»" ">") "»" ">")
;; è pour aller au début de ligne ;; è pour aller au début de ligne
(general-translate-key '(normal motion visual) keymap (evil-collection-translate-key '(normal motion visual) keymap
"è" "^" "è" "^"
"È" "0") "È" "0")
;; [W] -> [É] ;; [W] -> [É]
;; [C-W] -> [W] ;; [C-W] -> [W]
(general-translate-key '(normal motion operator visual) keymap (evil-collection-translate-key '(normal motion operator visual) keymap
"é" "w" "é" "w"
"É" "W" "É" "W"
"w" "C-w" "w" (kbd "C-w")
"W" "C-w C-w"))))) "W" (kbd "C-w C-w"))))))
doom-bepo-hook)) doom-bepo-hook))