From 485381f6d1c38751f02d77a0b74c33e764517e2f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 1 May 2021 00:56:08 -0400 Subject: [PATCH] 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. --- modules/input/layout/+bepo.el | 442 +++++++++--------- modules/input/layout/README.org | 12 +- modules/input/layout/autoload/bepo.el | 615 +++++++++++++------------- modules/input/layout/config.el | 18 +- 4 files changed, 550 insertions(+), 537 deletions(-) diff --git a/modules/input/layout/+bepo.el b/modules/input/layout/+bepo.el index 83dc36b8a..61dda0523 100644 --- a/modules/input/layout/+bepo.el +++ b/modules/input/layout/+bepo.el @@ -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,212 +35,221 @@ switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r"))) (map! "C-é" 'evil-window-map) - (map! - :leader - :desc "Window" "é" 'evil-window-map - (:when (featurep! :ui popup) - :desc "Toggle last popup" "#" #'+popup/toggle) - (:when (featurep! :ui workspaces) - :desc "Switch buffer" "«" #'switch-to-buffer) - :desc "Switch to last buffer" "$" #'evil-switch-to-windows-last-buffer - (:when (featurep! :ui workspaces) - (:prefix-map ("TAB" . "workspace") - :desc "Switch to last workspace" "$" #'+workspace/other - :desc "Next workspace" ")" #'+workspace/switch-right - :desc "Previous workspace" "(" #'+workspace/switch-left)) - (:prefix-map ("b" . "buffer") - :desc "Previous buffer" "(" #'previous-buffer - :desc "Next buffer" ")" #'next-buffer) - (:prefix-map ("c" . "code") - :desc "Jump to documentation" "S" #'+lookup/documentation) - (:prefix-map ("g" . "git") - (:when (featurep! :ui vc-gutter) - :desc "Jump to next hunk" ")" #'git-gutter:next-hunk - :desc "Jump to previous hunk" "(" #'git-gutter:previous-hunk)) - (:prefix-map ("p" . "project") - :desc "Browse other project" "»" #'doom/browse-in-other-project))) + (map! :leader + :desc "Window" "é" evil-window-map + (:when (featurep! :ui popup) + :desc "Toggle last popup" "#" #'+popup/toggle) + (:when (featurep! :ui workspaces) + :desc "Switch buffer" "«" #'switch-to-buffer) + :desc "Switch to last buffer" "$" #'evil-switch-to-windows-last-buffer + (:when (featurep! :ui workspaces) + (:prefix-map ("TAB" . "workspace") + :desc "Switch to last workspace" "$" #'+workspace/other + :desc "Next workspace" ")" #'+workspace/switch-right + :desc "Previous workspace" "(" #'+workspace/switch-left)) + (:prefix-map ("b" . "buffer") + :desc "Previous buffer" "(" #'previous-buffer + :desc "Next buffer" ")" #'next-buffer) + (:prefix-map ("c" . "code") + :desc "Jump to documentation" "S" #'+lookup/documentation) + (:prefix-map ("g" . "git") + (:when (featurep! :ui vc-gutter) + :desc "Jump to next hunk" ")" #'git-gutter:next-hunk + :desc "Jump to previous hunk" "(" #'git-gutter:previous-hunk)) + (:prefix-map ("p" . "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) +(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") + (down . "t") + (left . "c") + (right . "r")) + evil-org-movement-bindings '((up . "s") + (down . "t") + (left . "c") + (right . "r"))) + (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 - :nv "T" #'+multiple-cursors/evil-mc-toggle-cursors - :nv "j" #'+multiple-cursors/evil-mc-toggle-cursors) + :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 - (doom-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map))) - (after! (:or helm ivy selectrum icomplete) - (doom-bepo--evil-collection-hook - nil - '(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-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)) - (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))) - (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))) - (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))) - (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))) - (after! selectrum - (doom-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) doom-bepo-cr-rotation-style) - (doom-bepo--evil-collection-hook nil '(selectrum-minibuffer-map))) - (after! company - (doom-bepo-rotate-bare-keymap '(company-active-map company-search-map) doom-bepo-cr-rotation-style)) - (after! evil-snipe - (doom-bepo--evil-collection-hook - nil - '(evil-snipe-local-mode-map evil-snipe-override-local-mode-map))) - (after! lispyville - ;; <> en direct - (general-translate-key '(normal motion) 'lispyville-mode-map - "«" "<" - "»" ">")) - (after! lsp-ui - (doom-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." - :override #'org-completing-read - (let ((enable-recursive-minibuffers t) - (minibuffer-local-completion-map - (copy-keymap minibuffer-local-completion-map))) - (define-key minibuffer-local-completion-map " " 'self-insert-command) - (define-key minibuffer-local-completion-map "?" 'self-insert-command) - (define-key minibuffer-local-completion-map - (cond - ((eq doom-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)) - (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 - ;; Therefore, this map! needs to be reevaluated to have effect. - ;; Need to find a way to call the code below after the :config block - ;; in :lang org code + :n "C-$" #'+popup/toggle + :n "C-#" #'+popup/raise))) + (after! treemacs + (+layout-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map))) + (after! (:or helm ivy selectrum icomplete) + (+layout-bepo-rotate-keymaps + nil + '(minibuffer-local-map + minibuffer-local-ns-map + minibuffer-local-completion-map + minibuffer-local-must-match-map + minibuffer-local-isearch-map + read-expression-map)) + (+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) + +layout-bepo-cr-rotation-style)) + (after! ivy + (+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 + (+layout-bepo-rotate-bare-keymap '(helm-map) +layout-bepo-cr-rotation-style) + (+layout-bepo-rotate-keymaps nil '(helm-map))) + (after! helm-rg + (+layout-bepo-rotate-bare-keymap '(helm-rg-map) +layout-bepo-cr-rotation-style) + (+layout-bepo-rotate-keymaps nil '(helm-rg-map))) + (after! helm-files + (+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 + (+layout-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) +layout-bepo-cr-rotation-style) + (+layout-bepo-rotate-keymaps nil '(selectrum-minibuffer-map))) + (after! company + (+layout-bepo-rotate-bare-keymap '(company-active-map company-search-map) +layout-bepo-cr-rotation-style)) + (after! evil-snipe + (+layout-bepo-rotate-keymaps + nil + '(evil-snipe-local-mode-map evil-snipe-override-local-mode-map))) + (after! lispyville + ;; <> en direct + (general-translate-key '(normal motion) 'lispyville-mode-map + "«" "<" + "»" ">")) + (after! lsp-ui + (+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." + :override #'org-completing-read + (let ((enable-recursive-minibuffers t) + (minibuffer-local-completion-map + (copy-keymap minibuffer-local-completion-map))) + (define-key minibuffer-local-completion-map " " 'self-insert-command) + (define-key minibuffer-local-completion-map "?" 'self-insert-command) + (define-key minibuffer-local-completion-map + (cond + ((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` + (+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 + ;; Therefore, this map! needs to be reevaluated to have effect. + ;; Need to find a way to call the code below after the :config block + ;; in :lang org code - ;; Direct access for "unimpaired" like improvements - (map! :map evil-org-mode-map - ;; evil-org-movement bindings having "c" and "r" means - ;; C-r gets mapped to `org-shiftright' in normal and insert state. - ;; C-c gets mapped to `org-shiftleft' in normal and insert state. - :ni "C-r" nil - :ni "C-c" nil - :ni "C-»" #'org-shiftright - :ni "C-«" #'org-shiftleft - :m ")" nil - :m "(" nil - :m "]" #'evil-org-forward-sentence - :m "[" #'evil-org-backward-sentence - :m ")h" #'org-forward-heading-same-level - :m "(h" #'org-backward-heading-same-level - :m ")l" #'org-next-link - :m "(l" #'org-previous-link - :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))) - (after! notmuch - ;; 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 - (map! :map Info-mode-map - "s" nil - "t" nil)) - (after! (evil magit) - (doom-bepo-rotate-ts-bare-keymap - '(magit-mode-map - magit-diff-section-base-map - magit-staged-section-map - magit-unstaged-section-map - magit-untracked-section-map)) - ;; Without this, "s" is mapped to 'magit-delete-thing (the old "k" for "kill") and - ;; takes precedence over the evil command to go up one line - ;; :nv doesn't work on this, needs to be the bare map. - ;; This is the output of `describe-function 'magit-delete-thing` when we add :nv or :nvm - ;; Key Bindings - ;; evil-collection-magit-mode-map-backup-map x - ;; evil-collection-magit-mode-map-backup-map x - ;; evil-collection-magit-mode-map-backup-map k - ;; evil-collection-magit-mode-map-normal-state-backup-map x - ;; evil-collection-magit-mode-map-visual-state-backup-map x - ;; magit-mode-map x - ;; magit-mode-map 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 - nil - '(magit-cherry-mode-map - magit-blob-mode-map - magit-diff-mode-map - magit-log-mode-map - magit-log-select-mode-map - magit-reflog-mode-map - magit-status-mode-map - magit-log-read-revs-map - magit-process-mode-map - 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 - (evilem-default-keybindings "gé") - (doom-bepo-rotate-bare-keymap '(evilem-map) doom-bepo-cr-rotation-style)))) + ;; Direct access for "unimpaired" like improvements + (map! :map evil-org-mode-map + ;; evil-org-movement bindings having "c" and "r" means + ;; C-r gets mapped to `org-shiftright' in normal and insert state. + ;; C-c gets mapped to `org-shiftleft' in normal and insert state. + :ni "C-r" nil + :ni "C-c" nil + :ni "C-»" #'org-shiftright + :ni "C-«" #'org-shiftleft + :m ")" nil + :m "(" nil + :m "]" #'evil-org-forward-sentence + :m "[" #'evil-org-backward-sentence + :m ")h" #'org-forward-heading-same-level + :m "(h" #'org-backward-heading-same-level + :m ")l" #'org-next-link + :m "(l" #'org-previous-link + :m ")c" #'org-babel-next-src-block + :m "(c" #'org-babel-previous-src-block)) + (after! (evil org evil-org-agenda) + (+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 + (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' + (map! :map Info-mode-map + "s" nil + "t" nil)) + (after! (evil magit) + (+layout-bepo-rotate-ts-bare-keymap + '(magit-mode-map + magit-diff-section-base-map + magit-staged-section-map + magit-unstaged-section-map + magit-untracked-section-map)) + ;; Without this, "s" is mapped to 'magit-delete-thing (the old "k" for "kill") and + ;; takes precedence over the evil command to go up one line + ;; :nv doesn't work on this, needs to be the bare map. + ;; This is the output of `describe-function 'magit-delete-thing` when we add :nv or :nvm + ;; Key Bindings + ;; evil-collection-magit-mode-map-backup-map x + ;; evil-collection-magit-mode-map-backup-map x + ;; evil-collection-magit-mode-map-backup-map k + ;; evil-collection-magit-mode-map-normal-state-backup-map x + ;; evil-collection-magit-mode-map-visual-state-backup-map x + ;; magit-mode-map x + ;; magit-mode-map 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. + (+layout-bepo-rotate-keymaps + nil + '(magit-cherry-mode-map + magit-blob-mode-map + magit-diff-mode-map + magit-log-mode-map + magit-log-select-mode-map + magit-reflog-mode-map + magit-status-mode-map + magit-log-read-revs-map + magit-process-mode-map + magit-refs-mode-map + magit-mode-map))) + (after! evil-easymotion + ;; Use "gé" instead of default "gs" to avoid conflicts w/org-mode later + (evilem-default-keybindings "gé") + (+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)))) diff --git a/modules/input/layout/README.org b/modules/input/layout/README.org index 74debf0b5..400ac672d 100644 --- a/modules/input/layout/README.org +++ b/modules/input/layout/README.org @@ -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 diff --git a/modules/input/layout/autoload/bepo.el b/modules/input/layout/autoload/bepo.el index f70ff5ab5..845a2f855 100644 --- a/modules/input/layout/autoload/bepo.el +++ b/modules/input/layout/autoload/bepo.el @@ -1,329 +1,328 @@ -;;; 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 - "t" "j" - "T" "J" - "s" "k" - "S" "K" - "j" "t" - "J" "T" - "k" "s" - "K" "S" - (kbd "C-t") (kbd "C-j") - (kbd "C-s") (kbd "C-k") - (kbd "C-j") (kbd "C-t") - (kbd "C-k") (kbd "C-s") - (kbd "M-t") (kbd "M-j") - (kbd "M-s") (kbd "M-k") - (kbd "M-j") (kbd "M-t") - (kbd "M-k") (kbd "M-s") - (kbd "C-S-t") (kbd "C-S-j") - (kbd "C-S-s") (kbd "C-S-k") - (kbd "C-S-j") (kbd "C-S-t") - (kbd "C-S-k") (kbd "C-S-s") - (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")))) - -;;;###autoload -(defun doom-bepo-rotate-é-quotes-bare-keymap (keymaps) - "Rotate [w<>] with [é«»] in KEYMAP." - (dolist (keymap keymaps) - (evil-collection-translate-key nil keymap - "é" "w" - "É" "W" - "«" "<" - "»" ">" - (kbd "C-é") (kbd "C-w") - (kbd "C-«") (kbd "C-<") - (kbd "C-»") (kbd "C->") - (kbd "M-é") (kbd "M-w") - (kbd "M-«") (kbd "M-<") - (kbd "M-»") (kbd "M->") - (kbd "C-S-é") (kbd "C-S-w") - (kbd "C-S-«") (kbd "C-S-<") - (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->")))) - -;;;###autoload -(defun doom-bepo-rotate-cr-bare-keymap (keymaps &optional 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'. -Undefined behaviour in other cases, for forward compatibility." - (let ((style (or style 'ergodis))) - (dolist (keymap keymaps) - (progn - (evil-collection-translate-key nil keymap - "c" "h" - "C" "H" - "r" "l" - "R" "L" - (kbd "C-c") (kbd "C-h") - (kbd "C-r") (kbd "C-l") - (kbd "M-c") (kbd "M-h") - (kbd "M-r") (kbd "M-l") - (kbd "C-S-c") (kbd "C-S-h") - (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 - "h" "r" - "H" "R" - "l" "c" - "L" "C" - (kbd "C-h") (kbd "C-r") - (kbd "C-l") (kbd "C-c") - (kbd "M-h") (kbd "M-r") - (kbd "M-l") (kbd "M-c") - (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 - "h" "c" - "H" "C" - "l" "r" - "L" "R" - (kbd "C-h") (kbd "C-c") - (kbd "C-l") (kbd "C-r") - (kbd "M-h") (kbd "M-c") - (kbd "M-l") (kbd "M-r") - (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")))))))) - -;;;###autoload -(defun doom-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)) - -;;;###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) - "c" "h" - "C" "H" + (evil-collection-translate-key nil keymaps "t" "j" "T" "J" "s" "k" "S" "K" - "r" "l" - "R" "L" "j" "t" "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) - "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) - "h" "c" - "H" "C" - "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") + "K" "S" (kbd "C-t") (kbd "C-j") - (kbd "C-T") (kbd "C-J") (kbd "C-s") (kbd "C-k") - (kbd "C-S") (kbd "C-K") - (kbd "C-r") (kbd "C-l") - (kbd "C-R") (kbd "C-L") (kbd "C-j") (kbd "C-t") - (kbd "C-J") (kbd "C-T") (kbd "C-k") (kbd "C-s") - (kbd "C-K") (kbd "C-S")) - (cond ((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 - (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")))) - - - ;; <> as direct access - (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) - "è" "^" - "È" "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) - "é" "w" - "É" "W" - "w" (kbd "C-w") - "W" (kbd "C-w C-w"))) + (kbd "M-t") (kbd "M-j") + (kbd "M-s") (kbd "M-k") + (kbd "M-j") (kbd "M-t") + (kbd "M-k") (kbd "M-s") + (kbd "C-S-t") (kbd "C-S-j") + (kbd "C-S-s") (kbd "C-S-k") + (kbd "C-S-j") (kbd "C-S-t") + (kbd "C-S-k") (kbd "C-S-s") + (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"))) ;;;###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 - "c" "h" - "C" "H" - "t" "j" - "T" "J" - "s" "k" - "S" "K" - "r" "l" - "R" "L" - "j" "t" - "J" "T" - "k" "s" - "K" "S" - (kbd "C-c") (kbd "C-h") - (kbd "C-C") (kbd "C-H") - (kbd "C-t") (kbd "C-j") - (kbd "C-T") (kbd "C-J") - (kbd "C-s") (kbd "C-k") - (kbd "C-S") (kbd "C-K") - (kbd "C-r") (kbd "C-l") - (kbd "C-R") (kbd "C-L") - (kbd "C-j") (kbd "C-t") - (kbd "C-J") (kbd "C-T") - (kbd "C-k") (kbd "C-s") - (kbd "C-K") (kbd "C-S") - (kbd "M-c") (kbd "M-h") - (kbd "M-C") (kbd "M-H") - (kbd "M-t") (kbd "M-j") - (kbd "M-T") (kbd "M-J") - (kbd "M-s") (kbd "M-k") - (kbd "M-S") (kbd "M-K") - (kbd "M-r") (kbd "M-l") - (kbd "M-R") (kbd "M-L") - (kbd "M-j") (kbd "M-t") - (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 - "h" "r" - "H" "R" - "l" "c" - "L" "C" - (kbd "C-h") (kbd "C-r") - (kbd "C-H") (kbd "C-R") - (kbd "C-l") (kbd "C-c") - (kbd "C-L") (kbd "C-C") - (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 - "h" "c" - "H" "C" - "l" "r" - "L" "R" - (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 "M-h") (kbd "M-c") - (kbd "M-H") (kbd "M-C") - (kbd "M-l") (kbd "M-r") - (kbd "M-L") (kbd "M-R")))) +(defun +layout-bepo-rotate-é-quotes-bare-keymap (keymaps) + "Rotate [w<>] with [é«»] in KEYMAP." + (evil-collection-translate-key nil keymaps + "é" "w" + "É" "W" + "«" "<" + "»" ">" + (kbd "C-é") (kbd "C-w") + (kbd "C-«") (kbd "C-<") + (kbd "C-»") (kbd "C->") + (kbd "M-é") (kbd "M-w") + (kbd "M-«") (kbd "M-<") + (kbd "M-»") (kbd "M->") + (kbd "C-S-é") (kbd "C-S-w") + (kbd "C-S-«") (kbd "C-S-<") + (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->"))) +;;;###autoload +(defun +layout-bepo-rotate-cr-bare-keymap (keymaps &optional cr-style) + "Rotate [hl] with [cr] in KEYMAP. - (evil-collection-translate-key '(insert) keymap - (kbd "C-c") (kbd "C-h") - (kbd "C-C") (kbd "C-H") - (kbd "C-t") (kbd "C-j") - (kbd "C-T") (kbd "C-J") - (kbd "C-s") (kbd "C-k") - (kbd "C-S") (kbd "C-K") - (kbd "C-r") (kbd "C-l") - (kbd "C-R") (kbd "C-L") - (kbd "C-j") (kbd "C-t") - (kbd "C-J") (kbd "C-T") - (kbd "C-k") (kbd "C-s") - (kbd "C-K") (kbd "C-S") - (kbd "M-c") (kbd "M-h") - (kbd "M-C") (kbd "M-H") - (kbd "M-t") (kbd "M-j") - (kbd "M-T") (kbd "M-J") - (kbd "M-s") (kbd "M-k") - (kbd "M-S") (kbd "M-K") - (kbd "M-r") (kbd "M-l") - (kbd "M-R") (kbd "M-L") - (kbd "M-j") (kbd "M-t") - (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 - (kbd "C-h") (kbd "C-r") - (kbd "C-H") (kbd "C-R") - (kbd "C-l") (kbd "C-c") - (kbd "C-L") (kbd "C-C") - (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 "C-h") (kbd "C-c") - (kbd "C-H") (kbd "C-C") - (kbd "C-l") (kbd "C-r") - (kbd "C-L") (kbd "C-R") - (kbd "M-h") (kbd "M-c") - (kbd "M-H") (kbd "M-C") - (kbd "M-l") (kbd "M-r") - (kbd "M-L") (kbd "M-R") - ))) +If CR-STYLE is nil or 'ergodis, the old 'c' bindings will be mapped on 'l' and +the old 'r' on 'h'. - ;; <> en direct - (evil-collection-translate-key '(normal motion visual operator) keymap - "«" "<" - "»" ">") +Otherwise if CR-STYLE is 'strict, the old 'c' bindings will be mapped on 'h' and +the old 'r' on 'l'. - ;; è pour aller au début de ligne - (evil-collection-translate-key '(normal motion visual operator) keymap - "è" "^" - "È" "0") +Undefined behaviour in other cases, for forward compatibility." + (let ((cr-style (or cr-style +layout-bepo-cr-rotation-style))) + (evil-collection-translate-key nil keymaps + "c" "h" + "C" "H" + "r" "l" + "R" "L" + (kbd "C-c") (kbd "C-h") + (kbd "C-r") (kbd "C-l") + (kbd "M-c") (kbd "M-h") + (kbd "M-r") (kbd "M-l") + (kbd "C-S-c") (kbd "C-S-h") + (kbd "C-S-r") (kbd "C-S-l") + (kbd "M-S-c") (kbd "M-S-h") + (kbd "M-S-r") (kbd "M-S-l")) + (if (eq cr-style 'ergodis) + (evil-collection-translate-key nil keymaps + "h" "r" + "H" "R" + "l" "c" + "L" "C" + (kbd "C-h") (kbd "C-r") + (kbd "C-l") (kbd "C-c") + (kbd "M-h") (kbd "M-r") + (kbd "M-l") (kbd "M-c") + (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")) + (evil-collection-translate-key nil keymaps + "h" "c" + "H" "C" + "l" "r" + "L" "R" + (kbd "C-h") (kbd "C-c") + (kbd "C-l") (kbd "C-r") + (kbd "M-h") (kbd "M-c") + (kbd "M-l") (kbd "M-r") + (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"))))) - ;; [W] -> [É] - ;; [C-W] -> [W] - (evil-collection-translate-key '(normal motion operator visual) keymap - "é" "w" - "É" "W" - "w" (kbd "C-w") - "W" (kbd "C-w C-w")))))) - doom-bepo-hook)) +;;;###autoload +(defun +layout-bepo-rotate-bare-keymap (keymaps &optional cr-style) + "Rotate [hjklw<>] with [ctsré«»] in KEYMAP. +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 +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" + "T" "J" + "s" "k" + "S" "K" + "r" "l" + "R" "L" + "j" "t" + "J" "T" + "k" "s" + "K" "S") + (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") + (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")) + (evil-collection-translate-key nil '(evil-insert-state-map) + (kbd "C-c") (kbd "C-h") + (kbd "C-C") (kbd "C-H") + (kbd "C-t") (kbd "C-j") + (kbd "C-T") (kbd "C-J") + (kbd "C-s") (kbd "C-k") + (kbd "C-S") (kbd "C-K") + (kbd "C-r") (kbd "C-l") + (kbd "C-R") (kbd "C-L") + (kbd "C-j") (kbd "C-t") + (kbd "C-J") (kbd "C-T") + (kbd "C-k") (kbd "C-s") + (kbd "C-K") (kbd "C-S")) + (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")) + (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"))) + + ;; <> as direct access + (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) + "è" "^" + "È" "0") + + ;; [W] -> [É] + ;; [C-W] -> [W] + (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")))) + +;;;###autoload +(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" + "T" "J" + "s" "k" + "S" "K" + "r" "l" + "R" "L" + "j" "t" + "J" "T" + "k" "s" + "K" "S" + (kbd "C-c") (kbd "C-h") + (kbd "C-C") (kbd "C-H") + (kbd "C-t") (kbd "C-j") + (kbd "C-T") (kbd "C-J") + (kbd "C-s") (kbd "C-k") + (kbd "C-S") (kbd "C-K") + (kbd "C-r") (kbd "C-l") + (kbd "C-R") (kbd "C-L") + (kbd "C-j") (kbd "C-t") + (kbd "C-J") (kbd "C-T") + (kbd "C-k") (kbd "C-s") + (kbd "C-K") (kbd "C-S") + (kbd "M-c") (kbd "M-h") + (kbd "M-C") (kbd "M-H") + (kbd "M-t") (kbd "M-j") + (kbd "M-T") (kbd "M-J") + (kbd "M-s") (kbd "M-k") + (kbd "M-S") (kbd "M-K") + (kbd "M-r") (kbd "M-l") + (kbd "M-R") (kbd "M-L") + (kbd "M-j") (kbd "M-t") + (kbd "M-J") (kbd "M-T") + (kbd "M-k") (kbd "M-s") + (kbd "M-K") (kbd "M-S")) + (if (eq cr-style 'ergodis) + (evil-collection-translate-key '(normal motion visual operator) keymaps + "h" "r" + "H" "R" + "l" "c" + "L" "C" + (kbd "C-h") (kbd "C-r") + (kbd "C-H") (kbd "C-R") + (kbd "C-l") (kbd "C-c") + (kbd "C-L") (kbd "C-C") + (kbd "M-h") (kbd "M-r") + (kbd "M-H") (kbd "M-R") + (kbd "M-l") (kbd "M-c") + (kbd "M-L") (kbd "M-C")) + (evil-collection-translate-key '(normal motion visual operator) keymaps + "h" "c" + "H" "C" + "l" "r" + "L" "R" + (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 "M-h") (kbd "M-c") + (kbd "M-H") (kbd "M-C") + (kbd "M-l") (kbd "M-r") + (kbd "M-L") (kbd "M-R"))) + + (evil-collection-translate-key '(insert) keymaps + (kbd "C-c") (kbd "C-h") + (kbd "C-C") (kbd "C-H") + (kbd "C-t") (kbd "C-j") + (kbd "C-T") (kbd "C-J") + (kbd "C-s") (kbd "C-k") + (kbd "C-S") (kbd "C-K") + (kbd "C-r") (kbd "C-l") + (kbd "C-R") (kbd "C-L") + (kbd "C-j") (kbd "C-t") + (kbd "C-J") (kbd "C-T") + (kbd "C-k") (kbd "C-s") + (kbd "C-K") (kbd "C-S") + (kbd "M-c") (kbd "M-h") + (kbd "M-C") (kbd "M-H") + (kbd "M-t") (kbd "M-j") + (kbd "M-T") (kbd "M-J") + (kbd "M-s") (kbd "M-k") + (kbd "M-S") (kbd "M-K") + (kbd "M-r") (kbd "M-l") + (kbd "M-R") (kbd "M-L") + (kbd "M-j") (kbd "M-t") + (kbd "M-J") (kbd "M-T") + (kbd "M-k") (kbd "M-s") + (kbd "M-K") (kbd "M-S")) + (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") + (kbd "C-L") (kbd "C-C") + (kbd "M-h") (kbd "M-r") + (kbd "M-H") (kbd "M-R") + (kbd "M-l") (kbd "M-c") + (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") + (kbd "C-L") (kbd "C-R") + (kbd "M-h") (kbd "M-c") + (kbd "M-H") (kbd "M-C") + (kbd "M-l") (kbd "M-r") + (kbd "M-L") (kbd "M-R"))) + + ;; <> en direct + (evil-collection-translate-key '(normal motion visual operator) keymaps + "«" "<" + "»" ">") + + ;; è pour aller au début de ligne + (evil-collection-translate-key '(normal motion visual operator) keymaps + "è" "^" + "È" "0") + + ;; [W] -> [É] + ;; [C-W] -> [W] + (evil-collection-translate-key '(normal motion operator visual) keymaps + "é" "w" + "É" "W" + "w" (kbd "C-w") + "W" (kbd "C-w C-w")))) diff --git a/modules/input/layout/config.el b/modules/input/layout/config.el index 2e8d667dd..1543eb280 100644 --- a/modules/input/layout/config.el +++ b/modules/input/layout/config.el @@ -1,14 +1,6 @@ -;;; input/keymaps/config.el -*- lexical-binding: t; -*- +;;; input/layout/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.") - -(when (featurep! +bepo) - (load! "+bepo")) +(add-hook! 'doom-init-modules-hook + (defun +layout-init-h () + (when (featurep! +bepo) + (load! "+bepo"))))