input/layout: major refactor
To conform the module to Doom's naming and style conventions. This introduces two breaking changes: + doom-bepo-cr-rotation-style was renamed +layout-bepo-cr-rotation-style + Replaces the doom-bepo- prefix for this module's bepo library with +layout-bepo- And the following fixes: + Corrects the file path in file header comments. + input/layout/autoload/bepo.el is no longer compiled/indexed if +bepo isn't activated.
This commit is contained in:
parent
4afdd4f788
commit
485381f6d1
4 changed files with 550 additions and 537 deletions
|
@ -1,20 +1,29 @@
|
|||
;;; input/layout/+bepo.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; NOTE: the evaluation loads the whole autoload/bepo.el file but it doesn't really matter as other
|
||||
;; functions are eagerly called in this block
|
||||
;; NOTE: since this file is loaded before $DOOMDIR/config.el, the cr-rotation-style variable
|
||||
;; if not default needs to be set up in $DOOMDIR/init.el
|
||||
(fset 'doom-bepo--evil-collection-hook
|
||||
(doom-bepo-rotate-collection-keymaps-h-builder doom-bepo-cr-rotation-style))
|
||||
(add-hook 'evil-collection-setup-hook #'doom-bepo--evil-collection-hook)
|
||||
(defvar +layout-bepo-cr-rotation-style 'ergodis
|
||||
"Modify this variable in your $DOOMDIR/init.el
|
||||
Style of binding rotation for the cr keys.
|
||||
If 'ergodis, then the module maps the old 'c' bindings to 'l' and the old 'r' to 'h', as
|
||||
the 'change' function is used more often and 'l' is easier to reach than 'h' in bépo.
|
||||
|
||||
If 'strict, the module does a normal swap and 'c' bindings go to 'h', 'r' bindings go to 'l'.
|
||||
|
||||
In all cases, 'h' functions go to 'c' and 'l' ones go to 'r' so the navigation keys still feel vim-like.")
|
||||
|
||||
;; Highlight non breaking spaces as error in prog modes only
|
||||
;; FIXME: this variable is defined in a file called xdisp.c Will that work in non-X builds ?
|
||||
;; From early observations in sway running pgtk fork, it does not.
|
||||
;; REVIEW `nobreak-char-display' is defined in xdisp.c; will that work in non-X
|
||||
;; builds? From early observations in sway+pgtk, it does not.
|
||||
(setq nobreak-char-display t)
|
||||
(set-face-attribute 'nobreak-space nil :underline t)
|
||||
|
||||
(add-transient-hook! 'doom-init-modules-hook
|
||||
|
||||
;;
|
||||
;;; Initializers
|
||||
|
||||
;; TODO Separate each package into their own hook, so users can
|
||||
;; enable/disable/add their own per-package remappings.
|
||||
|
||||
(defun +layout-remap-keys-for-bepo-h ()
|
||||
(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))
|
||||
|
||||
|
@ -26,9 +35,8 @@
|
|||
switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r")))
|
||||
|
||||
(map! "C-é" 'evil-window-map)
|
||||
(map!
|
||||
:leader
|
||||
:desc "Window" "é" 'evil-window-map
|
||||
(map! :leader
|
||||
:desc "Window" "é" evil-window-map
|
||||
(:when (featurep! :ui popup)
|
||||
:desc "Toggle last popup" "#" #'+popup/toggle)
|
||||
(:when (featurep! :ui workspaces)
|
||||
|
@ -51,8 +59,7 @@
|
|||
(:prefix-map ("p" . "project")
|
||||
:desc "Browse other project" "»" #'doom/browse-in-other-project)))
|
||||
|
||||
(when (featurep! :editor evil)
|
||||
(add-transient-hook! 'doom-init-modules-hook
|
||||
(defun +layout-remap-evil-keys-for-bepo-h ()
|
||||
;; "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")
|
||||
|
@ -63,26 +70,28 @@
|
|||
(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)
|
||||
(after! evil
|
||||
(+layout-bepo-rotate-ts-bare-keymap '(read-expression-map))
|
||||
(+layout-bepo-rotate-bare-keymap '(evil-window-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-evil-keymap +layout-bepo-cr-rotation-style)
|
||||
|
||||
(evil-define-key* 'insert 'global (kbd "C-t") #'+default-newline)
|
||||
(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
|
||||
;; 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))
|
||||
:n "C-#" #'+popup/raise)))
|
||||
(after! treemacs
|
||||
(doom-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map)))
|
||||
(+layout-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map)))
|
||||
(after! (:or helm ivy selectrum icomplete)
|
||||
(doom-bepo--evil-collection-hook
|
||||
(+layout-bepo-rotate-keymaps
|
||||
nil
|
||||
'(minibuffer-local-map
|
||||
minibuffer-local-ns-map
|
||||
|
@ -90,35 +99,35 @@
|
|||
minibuffer-local-must-match-map
|
||||
minibuffer-local-isearch-map
|
||||
read-expression-map))
|
||||
(doom-bepo-rotate-bare-keymap
|
||||
(+layout-bepo-rotate-bare-keymap
|
||||
'(minibuffer-local-map
|
||||
minibuffer-local-ns-map
|
||||
minibuffer-local-completion-map
|
||||
minibuffer-local-must-match-map
|
||||
minibuffer-local-isearch-map
|
||||
read-expression-map)
|
||||
doom-bepo-cr-rotation-style))
|
||||
+layout-bepo-cr-rotation-style))
|
||||
(after! ivy
|
||||
(doom-bepo-rotate-bare-keymap '(ivy-minibuffer-map ivy-switch-buffer-map) doom-bepo-cr-rotation-style)
|
||||
(doom-bepo--evil-collection-hook nil '(ivy-minibuffer-map ivy-switch-buffer-map)))
|
||||
(+layout-bepo-rotate-bare-keymap '(ivy-minibuffer-map ivy-switch-buffer-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(ivy-minibuffer-map ivy-switch-buffer-map)))
|
||||
(after! swiper
|
||||
(map! :map swiper-map "C-s" nil))
|
||||
(after! helm
|
||||
(doom-bepo-rotate-bare-keymap '(helm-map) doom-bepo-cr-rotation-style)
|
||||
(doom-bepo--evil-collection-hook nil '(helm-map)))
|
||||
(+layout-bepo-rotate-bare-keymap '(helm-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(helm-map)))
|
||||
(after! helm-rg
|
||||
(doom-bepo-rotate-bare-keymap '(helm-rg-map) doom-bepo-cr-rotation-style)
|
||||
(doom-bepo--evil-collection-hook nil '(helm-rg-map)))
|
||||
(+layout-bepo-rotate-bare-keymap '(helm-rg-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(helm-rg-map)))
|
||||
(after! helm-files
|
||||
(doom-bepo-rotate-bare-keymap '(helm-read-file-map) doom-bepo-cr-rotation-style)
|
||||
(doom-bepo--evil-collection-hook nil '(helm-read-file-map)))
|
||||
(+layout-bepo-rotate-bare-keymap '(helm-read-file-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(helm-read-file-map)))
|
||||
(after! selectrum
|
||||
(doom-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) doom-bepo-cr-rotation-style)
|
||||
(doom-bepo--evil-collection-hook nil '(selectrum-minibuffer-map)))
|
||||
(+layout-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(selectrum-minibuffer-map)))
|
||||
(after! company
|
||||
(doom-bepo-rotate-bare-keymap '(company-active-map company-search-map) doom-bepo-cr-rotation-style))
|
||||
(+layout-bepo-rotate-bare-keymap '(company-active-map company-search-map) +layout-bepo-cr-rotation-style))
|
||||
(after! evil-snipe
|
||||
(doom-bepo--evil-collection-hook
|
||||
(+layout-bepo-rotate-keymaps
|
||||
nil
|
||||
'(evil-snipe-local-mode-map evil-snipe-override-local-mode-map)))
|
||||
(after! lispyville
|
||||
|
@ -127,7 +136,7 @@
|
|||
"«" "<"
|
||||
"»" ">"))
|
||||
(after! lsp-ui
|
||||
(doom-bepo-rotate-ts-bare-keymap '(lsp-ui-peek-mode-map)))
|
||||
(+layout-bepo-rotate-ts-bare-keymap '(lsp-ui-peek-mode-map)))
|
||||
(after! org
|
||||
(defadvice! doom-bepo--org-completing-read (&rest args)
|
||||
"Completing-read with SPACE being a normal character, and C-c mapping left alone."
|
||||
|
@ -139,14 +148,14 @@
|
|||
(define-key minibuffer-local-completion-map "?" 'self-insert-command)
|
||||
(define-key minibuffer-local-completion-map
|
||||
(cond
|
||||
((eq doom-bepo-cr-rotation-style 'ergodis)
|
||||
((eq +layout-bepo-cr-rotation-style 'ergodis)
|
||||
(kbd "C-l !"))
|
||||
(t
|
||||
(kbd "C-h !")))
|
||||
'org-time-stamp-inactive)
|
||||
(apply #'completing-read args)))
|
||||
;; Finalizing an Org-capture become `C-l C-c` (or `C-r C-c`) on top of `ZZ`
|
||||
(doom-bepo-rotate-bare-keymap '(org-capture-mode-map) doom-bepo-cr-rotation-style))
|
||||
(+layout-bepo-rotate-bare-keymap '(org-capture-mode-map) +layout-bepo-cr-rotation-style))
|
||||
(after! (evil org evil-org)
|
||||
;; FIXME: This map! call is being interpreted before the
|
||||
;; map! call in (use-package! evil-org :config) in modules/lang/org/config.el
|
||||
|
@ -174,23 +183,23 @@
|
|||
:m ")c" #'org-babel-next-src-block
|
||||
:m "(c" #'org-babel-previous-src-block))
|
||||
(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)))
|
||||
(+layout-bepo-rotate-bare-keymap '(org-agenda-keymap) +layout-bepo-cr-rotation-style)
|
||||
(+layout-bepo-rotate-keymaps nil '(evil-org-agenda-mode-map)))
|
||||
(after! notmuch
|
||||
;; Without this, "s" is mapped to 'notmuch-search and
|
||||
;; takes precedence over the evil command to go up one line
|
||||
;; Without this, "s" is mapped to `notmuch-search' and takes precedence over
|
||||
;; the evil command to go up one line
|
||||
(map! :map notmuch-common-keymap :n "s" nil)
|
||||
(map! :map notmuch-common-keymap "s" nil))
|
||||
(after! (evil info)
|
||||
;; Without this, "s" stays mapped to 'Info-search (in the "global"
|
||||
;; Info-mode-map) and takes precedence over the evil command to go up one
|
||||
;; line (remapped in Info-mode-normal-state-map).
|
||||
;; Same for "t" that is 'Info-top-node in the "global" Info-mode-map
|
||||
;; `Info-mode-map') and takes precedence over the evil command to go up one
|
||||
;; line (remapped in `Info-mode-normal-state-map'). Same for "t" that is
|
||||
;; `Info-top-node' in the "global" `Info-mode-map'
|
||||
(map! :map Info-mode-map
|
||||
"s" nil
|
||||
"t" nil))
|
||||
(after! (evil magit)
|
||||
(doom-bepo-rotate-ts-bare-keymap
|
||||
(+layout-bepo-rotate-ts-bare-keymap
|
||||
'(magit-mode-map
|
||||
magit-diff-section-base-map
|
||||
magit-staged-section-map
|
||||
|
@ -210,14 +219,13 @@
|
|||
;; magit-mode-map <visual-state> x
|
||||
;; magit-mode-map s
|
||||
(map! :map magit-mode-map "s" nil)
|
||||
;; Even though magit bindings are part of evil-collection now,
|
||||
;; the hook only runs on `evil-collection-magit-maps`, which is
|
||||
;; way to short to cover all usages.
|
||||
;; The hook is run manually on other maps
|
||||
;; NOTE: magit-mode-map is last because other keymaps inherit from it.
|
||||
;; Therefore to prevent a "double rotation" issue, magit-mode-map is
|
||||
;; changed last
|
||||
(doom-bepo--evil-collection-hook
|
||||
;; Even though magit bindings are part of evil-collection now, the hook only
|
||||
;; runs on `evil-collection-magit-maps', which is way to short to cover all
|
||||
;; usages. The hook is run manually on other maps
|
||||
;; NOTE `magit-mode-map' is last because other keymaps inherit from it.
|
||||
;; Therefore to prevent a "double rotation" issue, `magit-mode-map' is
|
||||
;; changed last.
|
||||
(+layout-bepo-rotate-keymaps
|
||||
nil
|
||||
'(magit-cherry-mode-map
|
||||
magit-blob-mode-map
|
||||
|
@ -231,7 +239,17 @@
|
|||
magit-refs-mode-map
|
||||
magit-mode-map)))
|
||||
(after! evil-easymotion
|
||||
;; instead of using gs as the evilem-map we use gé to avoid conflicts with org-mode
|
||||
;; down the road
|
||||
;; Use "gé" instead of default "gs" to avoid conflicts w/org-mode later
|
||||
(evilem-default-keybindings "gé")
|
||||
(doom-bepo-rotate-bare-keymap '(evilem-map) doom-bepo-cr-rotation-style))))
|
||||
(+layout-bepo-rotate-bare-keymap '(evilem-map) +layout-bepo-cr-rotation-style)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(+layout-remap-keys-for-bepo-h)
|
||||
(when (featurep! :editor evil)
|
||||
(+layout-remap-evil-keys-for-bepo-h)
|
||||
(add-hook! 'evil-collection-setup-hook
|
||||
(defun +layout-bepo-rotate-evil-collection-keymap (_mode mode-keymaps &rest _rest)
|
||||
(+layout-bepo-rotate-keymaps mode-keymaps))))
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
- [[#configuration][Configuration]]
|
||||
- [[#bépo-1][Bépo]]
|
||||
- [[#troubleshooting][Troubleshooting]]
|
||||
- [[#outstanding-issues-contributions-welcome][Outstanding issues (contributions welcome)]]
|
||||
- [[#bépo-2][Bépo]]
|
||||
- [[#how-to-investigate-an-issue-][How to investigate an issue ?]]
|
||||
- [[#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 ?]]
|
||||
|
||||
|
@ -58,7 +60,6 @@ Support for the bépo layout includes:
|
|||
- Bind =`~= functions to =$#= keys when possible
|
||||
|
||||
*** Easymotion
|
||||
|
||||
If you use =evil-easymotion=, then all the bindings that were on =gs= have been
|
||||
moved to =gé=.
|
||||
|
||||
|
@ -106,14 +107,15 @@ Therefore, in org-mode:
|
|||
|
||||
* Configuration
|
||||
** Bépo
|
||||
=doom-bepo-cr-rotation-style= controls whether:
|
||||
=+layout-bepo-cr-rotation-style= controls whether:
|
||||
- =qwerty-c= functions are mapped on =bépo-l= key, and =qwerty-r= functions on
|
||||
=bépo-h= key (='ergodis=), or
|
||||
- =qwerty-c= functions are mapped on =bépo-h= key, and =qwerty-r= functions on
|
||||
=bépo-l= key (='strict=)
|
||||
|
||||
='strict= would be the logical choice but the =c= functions are used more often
|
||||
than the =r= ones so [[https://bepo.fr/wiki/Vim#Principe][Ergodis]] advises to
|
||||
actually put all the =c= functions on the key that does not need a curl.
|
||||
than the =r= ones so [[https://bepo.fr/wiki/Vim#Principe][Ergodis]] advises to actually put all the =c= functions on
|
||||
the key that does not need a curl.
|
||||
|
||||
* Troubleshooting
|
||||
# Common issues and their solution, or places to look for help.
|
||||
|
@ -121,6 +123,7 @@ actually put all the =c= functions on the key that does not need a curl.
|
|||
*** Bépo
|
||||
- in eshell, the key `c` is still bound to
|
||||
`evil-collection-eshell-evil-change` in normal mode
|
||||
|
||||
** How to investigate an issue ?
|
||||
If a key is misbehaving, use =describe-key= (=C-h k= or =SPC h k= or =F1 k=) to
|
||||
see the functions bound to the key, and more importantly in which map it is
|
||||
|
@ -132,6 +135,7 @@ active.
|
|||
|
||||
Most likely the solution is to call one of the "key rotation" functions on the
|
||||
relevant keymaps.
|
||||
|
||||
** How to deactivate the new bindings and go back to the old ones ?
|
||||
If you are learning a new layout you might want to go back to tho old one to
|
||||
"get work done". Sadly the only way is to comment out the module, run =doom
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
;;; input/keymaps/autoload/bepo.el -*- lexical-binding: t; -*-
|
||||
;;; input/layout/autoload/bepo.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +bepo)
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-ts-bare-keymap (keymaps)
|
||||
(defun +layout-bepo-rotate-ts-bare-keymap (keymaps)
|
||||
"Rotate [jk] with [ts] in KEYMAP."
|
||||
(dolist (keymap keymaps)
|
||||
(evil-collection-translate-key nil keymap
|
||||
(evil-collection-translate-key nil keymaps
|
||||
"t" "j"
|
||||
"T" "J"
|
||||
"s" "k"
|
||||
|
@ -28,13 +28,12 @@
|
|||
(kbd "M-S-t") (kbd "M-S-j")
|
||||
(kbd "M-S-s") (kbd "M-S-k")
|
||||
(kbd "M-S-j") (kbd "M-S-t")
|
||||
(kbd "M-S-k") (kbd "M-S-s"))))
|
||||
(kbd "M-S-k") (kbd "M-S-s")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-é-quotes-bare-keymap (keymaps)
|
||||
(defun +layout-bepo-rotate-é-quotes-bare-keymap (keymaps)
|
||||
"Rotate [w<>] with [é«»] in KEYMAP."
|
||||
(dolist (keymap keymaps)
|
||||
(evil-collection-translate-key nil keymap
|
||||
(evil-collection-translate-key nil keymaps
|
||||
"é" "w"
|
||||
"É" "W"
|
||||
"«" "<"
|
||||
|
@ -50,19 +49,21 @@
|
|||
(kbd "C-S-»") (kbd "C-S->")
|
||||
(kbd "M-S-é") (kbd "M-S-w")
|
||||
(kbd "M-S-«") (kbd "M-S-<")
|
||||
(kbd "M-S-»") (kbd "M-S->"))))
|
||||
(kbd "M-S-»") (kbd "M-S->")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-cr-bare-keymap (keymaps &optional style)
|
||||
(defun +layout-bepo-rotate-cr-bare-keymap (keymaps &optional cr-style)
|
||||
"Rotate [hl] with [cr] in KEYMAP.
|
||||
|
||||
If STYLE is nil or 'ergodis, the old 'c' bindings will be mapped on 'l' and the old 'r' on 'h'.
|
||||
Otherwise if STYLE is 'strict, the old 'c' bindings will be mapped on 'h' and the old 'r' on 'l'.
|
||||
If CR-STYLE is nil or 'ergodis, the old 'c' bindings will be mapped on 'l' and
|
||||
the old 'r' on 'h'.
|
||||
|
||||
Otherwise if CR-STYLE is 'strict, the old 'c' bindings will be mapped on 'h' and
|
||||
the old 'r' on 'l'.
|
||||
|
||||
Undefined behaviour in other cases, for forward compatibility."
|
||||
(let ((style (or style 'ergodis)))
|
||||
(dolist (keymap keymaps)
|
||||
(progn
|
||||
(evil-collection-translate-key nil keymap
|
||||
(let ((cr-style (or cr-style +layout-bepo-cr-rotation-style)))
|
||||
(evil-collection-translate-key nil keymaps
|
||||
"c" "h"
|
||||
"C" "H"
|
||||
"r" "l"
|
||||
|
@ -75,8 +76,8 @@ Undefined behaviour in other cases, for forward compatibility."
|
|||
(kbd "C-S-r") (kbd "C-S-l")
|
||||
(kbd "M-S-c") (kbd "M-S-h")
|
||||
(kbd "M-S-r") (kbd "M-S-l"))
|
||||
(cond ((eq style 'ergodis)
|
||||
(evil-collection-translate-key nil keymap
|
||||
(if (eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key nil keymaps
|
||||
"h" "r"
|
||||
"H" "R"
|
||||
"l" "c"
|
||||
|
@ -88,9 +89,8 @@ Undefined behaviour in other cases, for forward compatibility."
|
|||
(kbd "C-S-h") (kbd "C-S-r")
|
||||
(kbd "C-S-l") (kbd "C-S-c")
|
||||
(kbd "M-S-h") (kbd "M-S-r")
|
||||
(kbd "M-S-l") (kbd "M-S-c")))
|
||||
(t
|
||||
(evil-collection-translate-key nil keymap
|
||||
(kbd "M-S-l") (kbd "M-S-c"))
|
||||
(evil-collection-translate-key nil keymaps
|
||||
"h" "c"
|
||||
"H" "C"
|
||||
"l" "r"
|
||||
|
@ -102,22 +102,25 @@ Undefined behaviour in other cases, for forward compatibility."
|
|||
(kbd "C-S-h") (kbd "C-S-c")
|
||||
(kbd "C-S-l") (kbd "C-S-r")
|
||||
(kbd "M-S-h") (kbd "M-S-c")
|
||||
(kbd "M-S-l") (kbd "M-S-r"))))))))
|
||||
(kbd "M-S-l") (kbd "M-S-r")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-bare-keymap (keymaps &optional cr-style)
|
||||
(defun +layout-bepo-rotate-bare-keymap (keymaps &optional cr-style)
|
||||
"Rotate [hjklw<>] with [ctsré«»] in KEYMAP.
|
||||
See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE"
|
||||
(doom-bepo-rotate-cr-bare-keymap keymaps cr-style)
|
||||
(doom-bepo-rotate-ts-bare-keymap keymaps)
|
||||
(doom-bepo-rotate-é-quotes-bare-keymap keymaps))
|
||||
See `+layout-bepo-cr-rotation-style' for the meaning of CR-STYLE"
|
||||
(+layout-bepo-rotate-cr-bare-keymap keymaps cr-style)
|
||||
(+layout-bepo-rotate-ts-bare-keymap keymaps)
|
||||
(+layout-bepo-rotate-é-quotes-bare-keymap keymaps))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-evil-keymap (&optional cr-style)
|
||||
"Remap evil-{normal,operator,motion,...}-state-map
|
||||
to be more natural with Bépo keyboard layout.
|
||||
See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
(defun +layout-bepo-rotate-evil-keymap (&optional cr-style)
|
||||
"Remap evil-{normal,operator,motion,...}-state-map to be more natural with
|
||||
Bépo keyboard layout.
|
||||
|
||||
See `+layout-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
||||
(let ((cr-style (or cr-style +layout-bepo-cr-rotation-style)))
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
"c" "h"
|
||||
"C" "H"
|
||||
"t" "j"
|
||||
|
@ -130,19 +133,19 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
"J" "T"
|
||||
"k" "s"
|
||||
"K" "S")
|
||||
(cond ((eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
(if (eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
"h" "r"
|
||||
"H" "R"
|
||||
"l" "c"
|
||||
"L" "C"))
|
||||
(t
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
"L" "C")
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-visual-state-map evil-operator-state-map)
|
||||
"h" "c"
|
||||
"H" "C"
|
||||
"l" "r"
|
||||
"L" "R")))
|
||||
|
||||
"L" "R"))
|
||||
(evil-collection-translate-key nil '(evil-insert-state-map)
|
||||
(kbd "C-c") (kbd "C-h")
|
||||
(kbd "C-C") (kbd "C-H")
|
||||
|
@ -156,46 +159,47 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "C-J") (kbd "C-T")
|
||||
(kbd "C-k") (kbd "C-s")
|
||||
(kbd "C-K") (kbd "C-S"))
|
||||
(cond ((eq cr-style 'ergodis)
|
||||
(if (eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key nil '(evil-insert-state-map)
|
||||
(kbd "C-h") (kbd "C-r")
|
||||
(kbd "C-H") (kbd "C-R")
|
||||
(kbd "C-l") (kbd "C-c")
|
||||
(kbd "C-L") (kbd "C-C")))
|
||||
(t
|
||||
(kbd "C-L") (kbd "C-C"))
|
||||
(evil-collection-translate-key nil '(evil-insert-state-map)
|
||||
(kbd "C-h") (kbd "C-c")
|
||||
(kbd "C-H") (kbd "C-C")
|
||||
(kbd "C-l") (kbd "C-r")
|
||||
(kbd "C-L") (kbd "C-R"))))
|
||||
|
||||
(kbd "C-L") (kbd "C-R")))
|
||||
|
||||
;; <> as direct access
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
|
||||
"«" "<"
|
||||
"»" ">")
|
||||
|
||||
;; " è replaces ^0 to go at BOL
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
|
||||
"è" "^"
|
||||
"È" "0")
|
||||
|
||||
;; [W] -> [É]
|
||||
;; [C-W] -> [W]
|
||||
(evil-collection-translate-key nil '(evil-normal-state-map evil-motion-state-map evil-operator-state-map evil-operator-state-map)
|
||||
(evil-collection-translate-key nil
|
||||
'(evil-normal-state-map evil-motion-state-map evil-operator-state-map)
|
||||
"é" "w"
|
||||
"É" "W"
|
||||
"w" (kbd "C-w")
|
||||
"W" (kbd "C-w C-w")))
|
||||
"W" (kbd "C-w C-w"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-bepo-rotate-collection-keymaps-h-builder (cr-style)
|
||||
"Build a hook that remaps evil-collection customizations to be more natural
|
||||
with Bépo keyboard layout, according to CR-STYLE (see `doom-bepo-cr-rotation-style')."
|
||||
(let* ((cr-style (or cr-style 'ergodis))
|
||||
(doom-bepo-hook (lambda (_mode mode-keymaps &rest _rest)
|
||||
(dolist (keymap mode-keymaps)
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
||||
(defun +layout-bepo-rotate-keymaps (keymaps &optional cr-style)
|
||||
"Remap evil-collection keybinds in KEYMAPS for Bépo keyboard keyboard layouts.
|
||||
|
||||
Remappings are done according to CR-STYLE (see
|
||||
`+layout-bepo-cr-rotation-style')."
|
||||
(let ((cr-style (or cr-style +layout-bepo-cr-rotation-style)))
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymaps
|
||||
"c" "h"
|
||||
"C" "H"
|
||||
"t" "j"
|
||||
|
@ -232,8 +236,8 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-J") (kbd "M-T")
|
||||
(kbd "M-k") (kbd "M-s")
|
||||
(kbd "M-K") (kbd "M-S"))
|
||||
(cond ((eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
||||
(if (eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymaps
|
||||
"h" "r"
|
||||
"H" "R"
|
||||
"l" "c"
|
||||
|
@ -245,9 +249,8 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-h") (kbd "M-r")
|
||||
(kbd "M-H") (kbd "M-R")
|
||||
(kbd "M-l") (kbd "M-c")
|
||||
(kbd "M-L") (kbd "M-C")))
|
||||
(t
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
||||
(kbd "M-L") (kbd "M-C"))
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymaps
|
||||
"h" "c"
|
||||
"H" "C"
|
||||
"l" "r"
|
||||
|
@ -259,10 +262,9 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-h") (kbd "M-c")
|
||||
(kbd "M-H") (kbd "M-C")
|
||||
(kbd "M-l") (kbd "M-r")
|
||||
(kbd "M-L") (kbd "M-R"))))
|
||||
(kbd "M-L") (kbd "M-R")))
|
||||
|
||||
|
||||
(evil-collection-translate-key '(insert) keymap
|
||||
(evil-collection-translate-key '(insert) keymaps
|
||||
(kbd "C-c") (kbd "C-h")
|
||||
(kbd "C-C") (kbd "C-H")
|
||||
(kbd "C-t") (kbd "C-j")
|
||||
|
@ -287,8 +289,8 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-J") (kbd "M-T")
|
||||
(kbd "M-k") (kbd "M-s")
|
||||
(kbd "M-K") (kbd "M-S"))
|
||||
(cond ((eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key '(insert) keymap
|
||||
(if (eq cr-style 'ergodis)
|
||||
(evil-collection-translate-key '(insert) keymaps
|
||||
(kbd "C-h") (kbd "C-r")
|
||||
(kbd "C-H") (kbd "C-R")
|
||||
(kbd "C-l") (kbd "C-c")
|
||||
|
@ -296,9 +298,8 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-h") (kbd "M-r")
|
||||
(kbd "M-H") (kbd "M-R")
|
||||
(kbd "M-l") (kbd "M-c")
|
||||
(kbd "M-L") (kbd "M-C")))
|
||||
(t
|
||||
(evil-collection-translate-key '(insert) keymap
|
||||
(kbd "M-L") (kbd "M-C"))
|
||||
(evil-collection-translate-key '(insert) keymaps
|
||||
(kbd "C-h") (kbd "C-c")
|
||||
(kbd "C-H") (kbd "C-C")
|
||||
(kbd "C-l") (kbd "C-r")
|
||||
|
@ -306,24 +307,22 @@ See `doom-bepo-cr-rotation-style' for the meaning of CR-STYLE."
|
|||
(kbd "M-h") (kbd "M-c")
|
||||
(kbd "M-H") (kbd "M-C")
|
||||
(kbd "M-l") (kbd "M-r")
|
||||
(kbd "M-L") (kbd "M-R")
|
||||
)))
|
||||
(kbd "M-L") (kbd "M-R")))
|
||||
|
||||
;; <> en direct
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymaps
|
||||
"«" "<"
|
||||
"»" ">")
|
||||
|
||||
;; è pour aller au début de ligne
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
||||
(evil-collection-translate-key '(normal motion visual operator) keymaps
|
||||
"è" "^"
|
||||
"È" "0")
|
||||
|
||||
;; [W] -> [É]
|
||||
;; [C-W] -> [W]
|
||||
(evil-collection-translate-key '(normal motion operator visual) keymap
|
||||
(evil-collection-translate-key '(normal motion operator visual) keymaps
|
||||
"é" "w"
|
||||
"É" "W"
|
||||
"w" (kbd "C-w")
|
||||
"W" (kbd "C-w C-w"))))))
|
||||
doom-bepo-hook))
|
||||
"W" (kbd "C-w C-w"))))
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
;;; input/keymaps/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar doom-bepo-cr-rotation-style 'ergodis
|
||||
"Modify this variable in your $DOOMDIR/init.el
|
||||
Style of binding rotation for the cr keys.
|
||||
If 'ergodis, then the module maps the old 'c' bindings to 'l' and the old 'r' to 'h', as
|
||||
the 'change' function is used more often and 'l' is easier to reach than 'h' in bépo.
|
||||
|
||||
If 'strict, the module does a normal swap and 'c' bindings go to 'h', 'r' bindings go to 'l'.
|
||||
|
||||
In all cases, 'h' functions go to 'c' and 'l' ones go to 'r' so the navigation keys still feel vim-like.")
|
||||
;;; input/layout/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(add-hook! 'doom-init-modules-hook
|
||||
(defun +layout-init-h ()
|
||||
(when (featurep! +bepo)
|
||||
(load! "+bepo"))
|
||||
(load! "+bepo"))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue