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; -*-
|
;;; 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
|
(defvar +layout-bepo-cr-rotation-style 'ergodis
|
||||||
;; functions are eagerly called in this block
|
"Modify this variable in your $DOOMDIR/init.el
|
||||||
;; NOTE: since this file is loaded before $DOOMDIR/config.el, the cr-rotation-style variable
|
Style of binding rotation for the cr keys.
|
||||||
;; if not default needs to be set up in $DOOMDIR/init.el
|
If 'ergodis, then the module maps the old 'c' bindings to 'l' and the old 'r' to 'h', as
|
||||||
(fset 'doom-bepo--evil-collection-hook
|
the 'change' function is used more often and 'l' is easier to reach than 'h' in bépo.
|
||||||
(doom-bepo-rotate-collection-keymaps-h-builder doom-bepo-cr-rotation-style))
|
|
||||||
(add-hook 'evil-collection-setup-hook #'doom-bepo--evil-collection-hook)
|
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
|
;; 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 ?
|
;; REVIEW `nobreak-char-display' is defined in xdisp.c; will that work in non-X
|
||||||
;; From early observations in sway running pgtk fork, it does not.
|
;; builds? From early observations in sway+pgtk, it does not.
|
||||||
(setq nobreak-char-display t)
|
(setq nobreak-char-display t)
|
||||||
(set-face-attribute 'nobreak-space nil :underline 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)
|
(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))
|
||||||
|
|
||||||
|
@ -26,212 +35,221 @@
|
||||||
switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r")))
|
switch-window-qwerty-shortcuts '("a" "u" "i" "e" "," "c" "t" "s" "r")))
|
||||||
|
|
||||||
(map! "C-é" 'evil-window-map)
|
(map! "C-é" 'evil-window-map)
|
||||||
(map!
|
(map! :leader
|
||||||
:leader
|
:desc "Window" "é" evil-window-map
|
||||||
:desc "Window" "é" 'evil-window-map
|
(:when (featurep! :ui popup)
|
||||||
(:when (featurep! :ui popup)
|
:desc "Toggle last popup" "#" #'+popup/toggle)
|
||||||
:desc "Toggle last popup" "#" #'+popup/toggle)
|
(:when (featurep! :ui workspaces)
|
||||||
(:when (featurep! :ui workspaces)
|
:desc "Switch buffer" "«" #'switch-to-buffer)
|
||||||
:desc "Switch buffer" "«" #'switch-to-buffer)
|
:desc "Switch to last buffer" "$" #'evil-switch-to-windows-last-buffer
|
||||||
:desc "Switch to last buffer" "$" #'evil-switch-to-windows-last-buffer
|
(:when (featurep! :ui workspaces)
|
||||||
(:when (featurep! :ui workspaces)
|
(:prefix-map ("TAB" . "workspace")
|
||||||
(:prefix-map ("TAB" . "workspace")
|
:desc "Switch to last workspace" "$" #'+workspace/other
|
||||||
:desc "Switch to last workspace" "$" #'+workspace/other
|
:desc "Next workspace" ")" #'+workspace/switch-right
|
||||||
:desc "Next workspace" ")" #'+workspace/switch-right
|
:desc "Previous workspace" "(" #'+workspace/switch-left))
|
||||||
:desc "Previous workspace" "(" #'+workspace/switch-left))
|
(:prefix-map ("b" . "buffer")
|
||||||
(:prefix-map ("b" . "buffer")
|
:desc "Previous buffer" "(" #'previous-buffer
|
||||||
:desc "Previous buffer" "(" #'previous-buffer
|
:desc "Next buffer" ")" #'next-buffer)
|
||||||
:desc "Next buffer" ")" #'next-buffer)
|
(:prefix-map ("c" . "code")
|
||||||
(:prefix-map ("c" . "code")
|
:desc "Jump to documentation" "S" #'+lookup/documentation)
|
||||||
:desc "Jump to documentation" "S" #'+lookup/documentation)
|
(:prefix-map ("g" . "git")
|
||||||
(:prefix-map ("g" . "git")
|
(:when (featurep! :ui vc-gutter)
|
||||||
(:when (featurep! :ui vc-gutter)
|
: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)
|
(defun +layout-remap-evil-keys-for-bepo-h ()
|
||||||
(add-transient-hook! 'doom-init-modules-hook
|
;; "ts" would be a little too common for an evil escape sequence
|
||||||
;; "ts" would be a little too common for an evil escape sequence
|
(setq evil-escape-key-sequence "gq")
|
||||||
(setq evil-escape-key-sequence "gq")
|
(setq evil-markdown-movement-bindings '((up . "s")
|
||||||
(setq evil-markdown-movement-bindings '((up . "s")
|
(down . "t")
|
||||||
(down . "t")
|
(left . "c")
|
||||||
(left . "c")
|
(right . "r"))
|
||||||
(right . "r"))
|
evil-org-movement-bindings '((up . "s")
|
||||||
evil-org-movement-bindings '((up . "s")
|
(down . "t")
|
||||||
(down . "t")
|
(left . "c")
|
||||||
(left . "c")
|
(right . "r")))
|
||||||
(right . "r")))
|
(after! evil
|
||||||
(doom-bepo-rotate-ts-bare-keymap '(read-expression-map))
|
(+layout-bepo-rotate-ts-bare-keymap '(read-expression-map))
|
||||||
(doom-bepo-rotate-bare-keymap '(evil-window-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(evil-window-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo-rotate-evil-keymap doom-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
|
(map! :i "C-t" #'+default-newline
|
||||||
(:when (featurep! :editor multiple-cursors)
|
(:when (featurep! :editor multiple-cursors)
|
||||||
:prefix "gz"
|
:prefix "gz"
|
||||||
:nv "t" #'evil-mc-make-cursor-move-next-line
|
:nv "t" #'evil-mc-make-cursor-move-next-line
|
||||||
:nv "s" #'evil-mc-make-cursor-move-prev-line
|
:nv "s" #'evil-mc-make-cursor-move-prev-line
|
||||||
;; the old toggle mapping (t) is made available both on "T" for mnemonics and
|
;; The old toggle mapping (t) is made available both on "T" for
|
||||||
;; "j" as a "classic" rotation
|
;; mnemonics and "j" as a "classic" rotation
|
||||||
:nv "T" #'+multiple-cursors/evil-mc-toggle-cursors
|
:nv "T" #'+multiple-cursors/evil-mc-toggle-cursors
|
||||||
:nv "j" #'+multiple-cursors/evil-mc-toggle-cursors)
|
:nv "j" #'+multiple-cursors/evil-mc-toggle-cursors)
|
||||||
(:when (featurep! :ui popup)
|
(:when (featurep! :ui popup)
|
||||||
:n "C-$" #'+popup/toggle
|
:n "C-$" #'+popup/toggle
|
||||||
:n "C-#" #'+popup/raise))
|
:n "C-#" #'+popup/raise)))
|
||||||
(after! treemacs
|
(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)
|
(after! (:or helm ivy selectrum icomplete)
|
||||||
(doom-bepo--evil-collection-hook
|
(+layout-bepo-rotate-keymaps
|
||||||
nil
|
nil
|
||||||
'(minibuffer-local-map
|
'(minibuffer-local-map
|
||||||
minibuffer-local-ns-map
|
minibuffer-local-ns-map
|
||||||
minibuffer-local-completion-map
|
minibuffer-local-completion-map
|
||||||
minibuffer-local-must-match-map
|
minibuffer-local-must-match-map
|
||||||
minibuffer-local-isearch-map
|
minibuffer-local-isearch-map
|
||||||
read-expression-map))
|
read-expression-map))
|
||||||
(doom-bepo-rotate-bare-keymap
|
(+layout-bepo-rotate-bare-keymap
|
||||||
'(minibuffer-local-map
|
'(minibuffer-local-map
|
||||||
minibuffer-local-ns-map
|
minibuffer-local-ns-map
|
||||||
minibuffer-local-completion-map
|
minibuffer-local-completion-map
|
||||||
minibuffer-local-must-match-map
|
minibuffer-local-must-match-map
|
||||||
minibuffer-local-isearch-map
|
minibuffer-local-isearch-map
|
||||||
read-expression-map)
|
read-expression-map)
|
||||||
doom-bepo-cr-rotation-style))
|
+layout-bepo-cr-rotation-style))
|
||||||
(after! ivy
|
(after! ivy
|
||||||
(doom-bepo-rotate-bare-keymap '(ivy-minibuffer-map ivy-switch-buffer-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(ivy-minibuffer-map ivy-switch-buffer-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(ivy-minibuffer-map ivy-switch-buffer-map)))
|
(+layout-bepo-rotate-keymaps nil '(ivy-minibuffer-map ivy-switch-buffer-map)))
|
||||||
(after! swiper
|
(after! swiper
|
||||||
(map! :map swiper-map "C-s" nil))
|
(map! :map swiper-map "C-s" nil))
|
||||||
(after! helm
|
(after! helm
|
||||||
(doom-bepo-rotate-bare-keymap '(helm-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(helm-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(helm-map)))
|
(+layout-bepo-rotate-keymaps nil '(helm-map)))
|
||||||
(after! helm-rg
|
(after! helm-rg
|
||||||
(doom-bepo-rotate-bare-keymap '(helm-rg-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(helm-rg-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(helm-rg-map)))
|
(+layout-bepo-rotate-keymaps nil '(helm-rg-map)))
|
||||||
(after! helm-files
|
(after! helm-files
|
||||||
(doom-bepo-rotate-bare-keymap '(helm-read-file-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(helm-read-file-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(helm-read-file-map)))
|
(+layout-bepo-rotate-keymaps nil '(helm-read-file-map)))
|
||||||
(after! selectrum
|
(after! selectrum
|
||||||
(doom-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(selectrum-minibuffer-map)))
|
(+layout-bepo-rotate-keymaps nil '(selectrum-minibuffer-map)))
|
||||||
(after! company
|
(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
|
(after! evil-snipe
|
||||||
(doom-bepo--evil-collection-hook
|
(+layout-bepo-rotate-keymaps
|
||||||
nil
|
nil
|
||||||
'(evil-snipe-local-mode-map evil-snipe-override-local-mode-map)))
|
'(evil-snipe-local-mode-map evil-snipe-override-local-mode-map)))
|
||||||
(after! lispyville
|
(after! lispyville
|
||||||
;; <> en direct
|
;; <> en direct
|
||||||
(general-translate-key '(normal motion) 'lispyville-mode-map
|
(general-translate-key '(normal motion) 'lispyville-mode-map
|
||||||
"«" "<"
|
"«" "<"
|
||||||
"»" ">"))
|
"»" ">"))
|
||||||
(after! lsp-ui
|
(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
|
(after! org
|
||||||
(defadvice! doom-bepo--org-completing-read (&rest args)
|
(defadvice! doom-bepo--org-completing-read (&rest args)
|
||||||
"Completing-read with SPACE being a normal character, and C-c mapping left alone."
|
"Completing-read with SPACE being a normal character, and C-c mapping left alone."
|
||||||
:override #'org-completing-read
|
:override #'org-completing-read
|
||||||
(let ((enable-recursive-minibuffers t)
|
(let ((enable-recursive-minibuffers t)
|
||||||
(minibuffer-local-completion-map
|
(minibuffer-local-completion-map
|
||||||
(copy-keymap 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 "?" 'self-insert-command)
|
(define-key minibuffer-local-completion-map "?" 'self-insert-command)
|
||||||
(define-key minibuffer-local-completion-map
|
(define-key minibuffer-local-completion-map
|
||||||
(cond
|
(cond
|
||||||
((eq doom-bepo-cr-rotation-style 'ergodis)
|
((eq +layout-bepo-cr-rotation-style 'ergodis)
|
||||||
(kbd "C-l !"))
|
(kbd "C-l !"))
|
||||||
(t
|
(t
|
||||||
(kbd "C-h !")))
|
(kbd "C-h !")))
|
||||||
'org-time-stamp-inactive)
|
'org-time-stamp-inactive)
|
||||||
(apply #'completing-read args)))
|
(apply #'completing-read args)))
|
||||||
;; Finalizing an Org-capture become `C-l C-c` (or `C-r C-c`) on top of `ZZ`
|
;; 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)
|
(after! (evil org evil-org)
|
||||||
;; FIXME: This map! call is being interpreted before the
|
;; FIXME: This map! call is being interpreted before the
|
||||||
;; map! call in (use-package! evil-org :config) in modules/lang/org/config.el
|
;; map! call in (use-package! evil-org :config) in modules/lang/org/config.el
|
||||||
;; Therefore, this map! needs to be reevaluated to have effect.
|
;; Therefore, this map! needs to be reevaluated to have effect.
|
||||||
;; Need to find a way to call the code below after the :config block
|
;; Need to find a way to call the code below after the :config block
|
||||||
;; in :lang org code
|
;; in :lang org code
|
||||||
|
|
||||||
;; Direct access for "unimpaired" like improvements
|
;; Direct access for "unimpaired" like improvements
|
||||||
(map! :map evil-org-mode-map
|
(map! :map evil-org-mode-map
|
||||||
;; evil-org-movement bindings having "c" and "r" means
|
;; evil-org-movement bindings having "c" and "r" means
|
||||||
;; C-r gets mapped to `org-shiftright' in normal and insert state.
|
;; C-r gets mapped to `org-shiftright' in normal and insert state.
|
||||||
;; C-c gets mapped to `org-shiftleft' in normal and insert state.
|
;; C-c gets mapped to `org-shiftleft' in normal and insert state.
|
||||||
:ni "C-r" nil
|
:ni "C-r" nil
|
||||||
:ni "C-c" nil
|
:ni "C-c" nil
|
||||||
:ni "C-»" #'org-shiftright
|
:ni "C-»" #'org-shiftright
|
||||||
:ni "C-«" #'org-shiftleft
|
:ni "C-«" #'org-shiftleft
|
||||||
:m ")" nil
|
:m ")" nil
|
||||||
:m "(" nil
|
:m "(" nil
|
||||||
:m "]" #'evil-org-forward-sentence
|
:m "]" #'evil-org-forward-sentence
|
||||||
:m "[" #'evil-org-backward-sentence
|
:m "[" #'evil-org-backward-sentence
|
||||||
:m ")h" #'org-forward-heading-same-level
|
:m ")h" #'org-forward-heading-same-level
|
||||||
:m "(h" #'org-backward-heading-same-level
|
:m "(h" #'org-backward-heading-same-level
|
||||||
:m ")l" #'org-next-link
|
:m ")l" #'org-next-link
|
||||||
:m "(l" #'org-previous-link
|
:m "(l" #'org-previous-link
|
||||||
:m ")c" #'org-babel-next-src-block
|
:m ")c" #'org-babel-next-src-block
|
||||||
:m "(c" #'org-babel-previous-src-block))
|
:m "(c" #'org-babel-previous-src-block))
|
||||||
(after! (evil org evil-org-agenda)
|
(after! (evil org evil-org-agenda)
|
||||||
(doom-bepo-rotate-bare-keymap '(org-agenda-keymap) doom-bepo-cr-rotation-style)
|
(+layout-bepo-rotate-bare-keymap '(org-agenda-keymap) +layout-bepo-cr-rotation-style)
|
||||||
(doom-bepo--evil-collection-hook nil '(evil-org-agenda-mode-map)))
|
(+layout-bepo-rotate-keymaps nil '(evil-org-agenda-mode-map)))
|
||||||
(after! notmuch
|
(after! notmuch
|
||||||
;; Without this, "s" is mapped to 'notmuch-search and
|
;; Without this, "s" is mapped to `notmuch-search' and takes precedence over
|
||||||
;; takes precedence over the evil command to go up one line
|
;; the evil command to go up one line
|
||||||
(map! :map notmuch-common-keymap :n "s" nil)
|
(map! :map notmuch-common-keymap :n "s" nil)
|
||||||
(map! :map notmuch-common-keymap "s" nil))
|
(map! :map notmuch-common-keymap "s" nil))
|
||||||
(after! (evil info)
|
(after! (evil info)
|
||||||
;; Without this, "s" stays mapped to 'Info-search (in the "global"
|
;; 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
|
;; `Info-mode-map') and takes precedence over the evil command to go up one
|
||||||
;; line (remapped in Info-mode-normal-state-map).
|
;; line (remapped in `Info-mode-normal-state-map'). Same for "t" that is
|
||||||
;; Same for "t" that is 'Info-top-node in the "global" Info-mode-map
|
;; `Info-top-node' in the "global" `Info-mode-map'
|
||||||
(map! :map Info-mode-map
|
(map! :map Info-mode-map
|
||||||
"s" nil
|
"s" nil
|
||||||
"t" nil))
|
"t" nil))
|
||||||
(after! (evil magit)
|
(after! (evil magit)
|
||||||
(doom-bepo-rotate-ts-bare-keymap
|
(+layout-bepo-rotate-ts-bare-keymap
|
||||||
'(magit-mode-map
|
'(magit-mode-map
|
||||||
magit-diff-section-base-map
|
magit-diff-section-base-map
|
||||||
magit-staged-section-map
|
magit-staged-section-map
|
||||||
magit-unstaged-section-map
|
magit-unstaged-section-map
|
||||||
magit-untracked-section-map))
|
magit-untracked-section-map))
|
||||||
;; Without this, "s" is mapped to 'magit-delete-thing (the old "k" for "kill") and
|
;; 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
|
;; takes precedence over the evil command to go up one line
|
||||||
;; :nv doesn't work on this, needs to be the bare map.
|
;; :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
|
;; This is the output of `describe-function 'magit-delete-thing` when we add :nv or :nvm
|
||||||
;; Key Bindings
|
;; Key Bindings
|
||||||
;; evil-collection-magit-mode-map-backup-map <normal-state> x
|
;; evil-collection-magit-mode-map-backup-map <normal-state> x
|
||||||
;; evil-collection-magit-mode-map-backup-map <visual-state> x
|
;; evil-collection-magit-mode-map-backup-map <visual-state> x
|
||||||
;; evil-collection-magit-mode-map-backup-map k
|
;; evil-collection-magit-mode-map-backup-map k
|
||||||
;; evil-collection-magit-mode-map-normal-state-backup-map x
|
;; evil-collection-magit-mode-map-normal-state-backup-map x
|
||||||
;; evil-collection-magit-mode-map-visual-state-backup-map x
|
;; evil-collection-magit-mode-map-visual-state-backup-map x
|
||||||
;; magit-mode-map <normal-state> x
|
;; magit-mode-map <normal-state> x
|
||||||
;; magit-mode-map <visual-state> x
|
;; magit-mode-map <visual-state> x
|
||||||
;; magit-mode-map s
|
;; magit-mode-map s
|
||||||
(map! :map magit-mode-map "s" nil)
|
(map! :map magit-mode-map "s" nil)
|
||||||
;; Even though magit bindings are part of evil-collection now,
|
;; Even though magit bindings are part of evil-collection now, the hook only
|
||||||
;; the hook only runs on `evil-collection-magit-maps`, which is
|
;; runs on `evil-collection-magit-maps', which is way to short to cover all
|
||||||
;; way to short to cover all usages.
|
;; usages. The hook is run manually on other maps
|
||||||
;; The hook is run manually on other maps
|
;; NOTE `magit-mode-map' is last because other keymaps inherit from it.
|
||||||
;; NOTE: magit-mode-map is last because other keymaps inherit from it.
|
;; Therefore to prevent a "double rotation" issue, `magit-mode-map' is
|
||||||
;; Therefore to prevent a "double rotation" issue, magit-mode-map is
|
;; changed last.
|
||||||
;; changed last
|
(+layout-bepo-rotate-keymaps
|
||||||
(doom-bepo--evil-collection-hook
|
nil
|
||||||
nil
|
'(magit-cherry-mode-map
|
||||||
'(magit-cherry-mode-map
|
magit-blob-mode-map
|
||||||
magit-blob-mode-map
|
magit-diff-mode-map
|
||||||
magit-diff-mode-map
|
magit-log-mode-map
|
||||||
magit-log-mode-map
|
magit-log-select-mode-map
|
||||||
magit-log-select-mode-map
|
magit-reflog-mode-map
|
||||||
magit-reflog-mode-map
|
magit-status-mode-map
|
||||||
magit-status-mode-map
|
magit-log-read-revs-map
|
||||||
magit-log-read-revs-map
|
magit-process-mode-map
|
||||||
magit-process-mode-map
|
magit-refs-mode-map
|
||||||
magit-refs-mode-map
|
magit-mode-map)))
|
||||||
magit-mode-map)))
|
(after! evil-easymotion
|
||||||
(after! evil-easymotion
|
;; Use "gé" instead of default "gs" to avoid conflicts w/org-mode later
|
||||||
;; instead of using gs as the evilem-map we use gé to avoid conflicts with org-mode
|
(evilem-default-keybindings "gé")
|
||||||
;; down the road
|
(+layout-bepo-rotate-bare-keymap '(evilem-map) +layout-bepo-cr-rotation-style)))
|
||||||
(evilem-default-keybindings "gé")
|
|
||||||
(doom-bepo-rotate-bare-keymap '(evilem-map) doom-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]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#bépo-1][Bépo]]
|
- [[#bépo-1][Bépo]]
|
||||||
- [[#troubleshooting][Troubleshooting]]
|
- [[#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-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 ?]]
|
- [[#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
|
- Bind =`~= functions to =$#= keys when possible
|
||||||
|
|
||||||
*** Easymotion
|
*** Easymotion
|
||||||
|
|
||||||
If you use =evil-easymotion=, then all the bindings that were on =gs= have been
|
If you use =evil-easymotion=, then all the bindings that were on =gs= have been
|
||||||
moved to =gé=.
|
moved to =gé=.
|
||||||
|
|
||||||
|
@ -106,14 +107,15 @@ Therefore, in org-mode:
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
** Bépo
|
** 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
|
- =qwerty-c= functions are mapped on =bépo-l= key, and =qwerty-r= functions on
|
||||||
=bépo-h= key (='ergodis=), or
|
=bépo-h= key (='ergodis=), or
|
||||||
- =qwerty-c= functions are mapped on =bépo-h= key, and =qwerty-r= functions on
|
- =qwerty-c= functions are mapped on =bépo-h= key, and =qwerty-r= functions on
|
||||||
=bépo-l= key (='strict=)
|
=bépo-l= key (='strict=)
|
||||||
|
|
||||||
='strict= would be the logical choice but the =c= functions are used more often
|
='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
|
than the =r= ones so [[https://bepo.fr/wiki/Vim#Principe][Ergodis]] advises to actually put all the =c= functions on
|
||||||
actually put all the =c= functions on the key that does not need a curl.
|
the key that does not need a curl.
|
||||||
|
|
||||||
* Troubleshooting
|
* Troubleshooting
|
||||||
# Common issues and their solution, or places to look for help.
|
# 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
|
*** Bépo
|
||||||
- in eshell, the key `c` is still bound to
|
- in eshell, the key `c` is still bound to
|
||||||
`evil-collection-eshell-evil-change` in normal mode
|
`evil-collection-eshell-evil-change` in normal mode
|
||||||
|
|
||||||
** How to investigate an issue ?
|
** How to investigate an issue ?
|
||||||
If a key is misbehaving, use =describe-key= (=C-h k= or =SPC h k= or =F1 k=) to
|
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
|
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
|
Most likely the solution is to call one of the "key rotation" functions on the
|
||||||
relevant keymaps.
|
relevant keymaps.
|
||||||
|
|
||||||
** 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 ?
|
||||||
If you are learning a new layout you might want to go back to tho old one to
|
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
|
"get work done". Sadly the only way is to comment out the module, run =doom
|
||||||
|
|
|
@ -1,329 +1,328 @@
|
||||||
;;; input/keymaps/autoload/bepo.el -*- lexical-binding: t; -*-
|
;;; input/layout/autoload/bepo.el -*- lexical-binding: t; -*-
|
||||||
|
;;;###if (featurep! +bepo)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-bepo-rotate-ts-bare-keymap (keymaps)
|
(defun +layout-bepo-rotate-ts-bare-keymap (keymaps)
|
||||||
"Rotate [jk] with [ts] in KEYMAP."
|
"Rotate [jk] with [ts] in KEYMAP."
|
||||||
(dolist (keymap keymaps)
|
(evil-collection-translate-key nil 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"
|
|
||||||
"t" "j"
|
"t" "j"
|
||||||
"T" "J"
|
"T" "J"
|
||||||
"s" "k"
|
"s" "k"
|
||||||
"S" "K"
|
"S" "K"
|
||||||
"r" "l"
|
|
||||||
"R" "L"
|
|
||||||
"j" "t"
|
"j" "t"
|
||||||
"J" "T"
|
"J" "T"
|
||||||
"k" "s"
|
"k" "s"
|
||||||
"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")
|
|
||||||
(kbd "C-t") (kbd "C-j")
|
(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-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-J") (kbd "C-T")
|
|
||||||
(kbd "C-k") (kbd "C-s")
|
(kbd "C-k") (kbd "C-s")
|
||||||
(kbd "C-K") (kbd "C-S"))
|
(kbd "M-t") (kbd "M-j")
|
||||||
(cond ((eq cr-style 'ergodis)
|
(kbd "M-s") (kbd "M-k")
|
||||||
(evil-collection-translate-key nil '(evil-insert-state-map)
|
(kbd "M-j") (kbd "M-t")
|
||||||
(kbd "C-h") (kbd "C-r")
|
(kbd "M-k") (kbd "M-s")
|
||||||
(kbd "C-H") (kbd "C-R")
|
(kbd "C-S-t") (kbd "C-S-j")
|
||||||
(kbd "C-l") (kbd "C-c")
|
(kbd "C-S-s") (kbd "C-S-k")
|
||||||
(kbd "C-L") (kbd "C-C")))
|
(kbd "C-S-j") (kbd "C-S-t")
|
||||||
(t
|
(kbd "C-S-k") (kbd "C-S-s")
|
||||||
(evil-collection-translate-key nil '(evil-insert-state-map)
|
(kbd "M-S-t") (kbd "M-S-j")
|
||||||
(kbd "C-h") (kbd "C-c")
|
(kbd "M-S-s") (kbd "M-S-k")
|
||||||
(kbd "C-H") (kbd "C-C")
|
(kbd "M-S-j") (kbd "M-S-t")
|
||||||
(kbd "C-l") (kbd "C-r")
|
(kbd "M-S-k") (kbd "M-S-s")))
|
||||||
(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")))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-bepo-rotate-collection-keymaps-h-builder (cr-style)
|
(defun +layout-bepo-rotate-é-quotes-bare-keymap (keymaps)
|
||||||
"Build a hook that remaps evil-collection customizations to be more natural
|
"Rotate [w<>] with [é«»] in KEYMAP."
|
||||||
with Bépo keyboard layout, according to CR-STYLE (see `doom-bepo-cr-rotation-style')."
|
(evil-collection-translate-key nil keymaps
|
||||||
(let* ((cr-style (or cr-style 'ergodis))
|
"é" "w"
|
||||||
(doom-bepo-hook (lambda (_mode mode-keymaps &rest _rest)
|
"É" "W"
|
||||||
(dolist (keymap mode-keymaps)
|
"«" "<"
|
||||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
"»" ">"
|
||||||
"c" "h"
|
(kbd "C-é") (kbd "C-w")
|
||||||
"C" "H"
|
(kbd "C-«") (kbd "C-<")
|
||||||
"t" "j"
|
(kbd "C-»") (kbd "C->")
|
||||||
"T" "J"
|
(kbd "M-é") (kbd "M-w")
|
||||||
"s" "k"
|
(kbd "M-«") (kbd "M-<")
|
||||||
"S" "K"
|
(kbd "M-»") (kbd "M->")
|
||||||
"r" "l"
|
(kbd "C-S-é") (kbd "C-S-w")
|
||||||
"R" "L"
|
(kbd "C-S-«") (kbd "C-S-<")
|
||||||
"j" "t"
|
(kbd "C-S-»") (kbd "C-S->")
|
||||||
"J" "T"
|
(kbd "M-S-é") (kbd "M-S-w")
|
||||||
"k" "s"
|
(kbd "M-S-«") (kbd "M-S-<")
|
||||||
"K" "S"
|
(kbd "M-S-»") (kbd "M-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"))))
|
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +layout-bepo-rotate-cr-bare-keymap (keymaps &optional cr-style)
|
||||||
|
"Rotate [hl] with [cr] in KEYMAP.
|
||||||
|
|
||||||
(evil-collection-translate-key '(insert) keymap
|
If CR-STYLE is nil or 'ergodis, the old 'c' bindings will be mapped on 'l' and
|
||||||
(kbd "C-c") (kbd "C-h")
|
the old 'r' on '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")
|
|
||||||
)))
|
|
||||||
|
|
||||||
;; <> en direct
|
Otherwise if CR-STYLE is 'strict, the old 'c' bindings will be mapped on 'h' and
|
||||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
the old 'r' on 'l'.
|
||||||
"«" "<"
|
|
||||||
"»" ">")
|
|
||||||
|
|
||||||
;; è pour aller au début de ligne
|
Undefined behaviour in other cases, for forward compatibility."
|
||||||
(evil-collection-translate-key '(normal motion visual operator) keymap
|
(let ((cr-style (or cr-style +layout-bepo-cr-rotation-style)))
|
||||||
"è" "^"
|
(evil-collection-translate-key nil keymaps
|
||||||
"È" "0")
|
"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] -> [É]
|
;;;###autoload
|
||||||
;; [C-W] -> [W]
|
(defun +layout-bepo-rotate-bare-keymap (keymaps &optional cr-style)
|
||||||
(evil-collection-translate-key '(normal motion operator visual) keymap
|
"Rotate [hjklw<>] with [ctsré«»] in KEYMAP.
|
||||||
"é" "w"
|
See `+layout-bepo-cr-rotation-style' for the meaning of CR-STYLE"
|
||||||
"É" "W"
|
(+layout-bepo-rotate-cr-bare-keymap keymaps cr-style)
|
||||||
"w" (kbd "C-w")
|
(+layout-bepo-rotate-ts-bare-keymap keymaps)
|
||||||
"W" (kbd "C-w C-w"))))))
|
(+layout-bepo-rotate-é-quotes-bare-keymap keymaps))
|
||||||
doom-bepo-hook))
|
|
||||||
|
;;;###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"))))
|
||||||
|
|
|
@ -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
|
(add-hook! 'doom-init-modules-hook
|
||||||
"Modify this variable in your $DOOMDIR/init.el
|
(defun +layout-init-h ()
|
||||||
Style of binding rotation for the cr keys.
|
(when (featurep! +bepo)
|
||||||
If 'ergodis, then the module maps the old 'c' bindings to 'l' and the old 'r' to 'h', as
|
(load! "+bepo"))))
|
||||||
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"))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue