[Emacs] Better keybinds

This commit is contained in:
Lucien Cartier-Tilet 2021-10-18 17:29:15 +02:00
parent 8d80e42ba7
commit a0de3ae72d
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -730,6 +730,17 @@ prefix them with a comma (Ive taken this habit from Spacemacs).
evil-want-C-i-jump nil) evil-want-C-i-jump nil)
(require 'evil-vars) (require 'evil-vars)
(evil-set-undo-system 'undo-tree)) (evil-set-undo-system 'undo-tree))
:general
(:keymaps 'evil-motion-state-map
"SPC" nil
"," nil)
(:keymaps 'evil-insert-state-map
"C-t" nil)
(:keymaps 'evil-insert-state-map
"U" nil
"C-a" nil
"C-y" nil
"C-e" nil)
:config :config
(evil-mode 1) (evil-mode 1)
(setq evil-want-fine-undo t) ; more granular undo with evil (setq evil-want-fine-undo t) ; more granular undo with evil
@ -1143,10 +1154,21 @@ docker-compose from Emacs.
:commands elfeed-goodies/setup :commands elfeed-goodies/setup
:straight (:build t) :straight (:build t)
:init :init
(general-define-key :general
:keymaps 'elfeed-show-mode-map (:keymaps '(elfeed-show-mode-map elfeed-search-mode-map)
:states '(normal emacs)
"SPC" nil
"s" nil)
(:keymaps 'elfeed-show-mode-map
:states 'normal :states 'normal
"o" #'elfeed-goodies/show-ace-link)) "o" #'elfeed-goodies/show-ace-link)
(:keymaps 'elfeed-show-mode-map
:states 'normal
:prefix ","
"b" #'elfeed-show-visit
"n" #'elfeed-show-next
"p" #'elfeed-show-prev
"l" #'elfeed-show-next-link))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1927,9 +1949,16 @@ doing and what Git is doing! In short, I absolutely love it!
:custom :custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
:general :general
; global
(:keymaps '(magit-blame-read-only-mode-map magit-mode-map magit-diff-mode-map)
"SPC" nil)
(:keymaps '(git-rebase-mode-map) (:keymaps '(git-rebase-mode-map)
"C-t" #'evil-next-line "C-t" #'evil-next-line
"C-s" #'evil-previous-line) "C-s" #'evil-previous-line)
; evil
(:keymaps '(magit-mode-map)
:states '(normal visual)
"SPC" nil)
(:keymaps 'git-rebase-mode-map (:keymaps 'git-rebase-mode-map
:states 'normal :states 'normal
:prefix "," :prefix ","
@ -2255,8 +2284,11 @@ me.
:defer t :defer t
:hook (dired-mode . turn-on-gnus-dired-mode) :hook (dired-mode . turn-on-gnus-dired-mode)
:general :general
(:keymaps 'dired-mode-map
"SPC" nil)
(:keymaps 'dired-mode-map (:keymaps 'dired-mode-map
:states 'normal :states 'normal
"SPC" nil
"(" #'dired-hide-details-mode "(" #'dired-hide-details-mode
"n" #'evil-next-line "n" #'evil-next-line
"p" #'evil-previous-line) "p" #'evil-previous-line)
@ -2383,6 +2415,14 @@ Eshell is a built-in shell available from Emacs which I use almost as
often as fish. Some adjustments are necessary to make it fit my taste often as fish. Some adjustments are necessary to make it fit my taste
though. though.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(general-define-key
:keymaps 'eshell-mode-map
:states 'normal
"c" #'evil-backward-char
"t" #'evil-next-line
"s" #'evil-previous-line
"r" #'evil-forward-char)
(general-define-key (general-define-key
:keymaps 'eshell-mode-map :keymaps 'eshell-mode-map
:states 'insert :states 'insert
@ -2743,6 +2783,12 @@ extended however we like!
(org-macro ((t (:foreground "#b48ead")))) (org-macro ((t (:foreground "#b48ead"))))
:init :init
(auto-fill-mode -1) (auto-fill-mode -1)
:general
(:keymaps '(org-agenda-keymap org-agenda-mode-map)
"SPC" nil)
(:keymaps '(org-agenda-keymap org-agenda-mode-map)
:states 'motion
"SPC" nil)
:config :config
<<org-hydra-babel>> <<org-hydra-babel>>
(require 'ox-beamer) (require 'ox-beamer)
@ -4956,17 +5002,27 @@ which resolution to play a YouTube video in an external video player.
Undefining some stuff to make keybind prefixes work correctly. Undefining some stuff to make keybind prefixes work correctly.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(general-define-key (general-define-key
:keymaps '(backtrace-mode-map diff-minor-mode-map :keymaps '( Buffer-menu-mode-map
magit-mode-map rmail-mode-map evil-motion-state-map Man-mode-map
dired-mode-map epa-key-list-mode-map backtrace-mode-map
special-mode-map splash-screen-keymap custom-mode-map
undo-tree-visualizer-mode-map debugger-mode-map
magit-blame-read-only-mode-map org-agenda-keymap diff-minor-mode-map
org-agenda-mode-map git-rebase-mode-map diff-mode-map
Buffer-menu-mode-map custom-mode-map electric-help-map
gfm-view-mode-map electric-help-map image-mode-map epa-key-list-mode-map
magit-diff-mode-map elfeed-show-mode-map eshell-mode-map
grep-mode-map) eww-mode-map
gfm-view-mode-map
git-rebase-mode-map
grep-mode-map
help-mode-map
image-mode-map
rmail-mode-map
special-mode-map
splash-screen-keymap
undo-tree-visualizer-mode-map)
:states '(emacs normal motion)
"SPC" nil) "SPC" nil)
(general-define-key (general-define-key
@ -4974,48 +5030,18 @@ Undefining some stuff to make keybind prefixes work correctly.
"<mouse-2>" nil "<mouse-2>" nil
"<mouse-3>" nil) "<mouse-3>" nil)
(general-define-key ;; (general-define-key
:keymaps 'evil-motion-state-map ;; :keymaps '(diff-mode-map help-mode-map image-mode-map
"," nil) ;; custom-mode-map Man-mode-map eww-mode-map
;; debugger-mode-map custom-mode-map eshell-mode-map
;; image-mode-map help-mode-map)
;; :states 'normal
;; "SPC" nil)
(general-define-key ;; (general-define-key
:keymaps 'evil-insert-state-map ;; :keymaps 'diff-mode-map
"C-t" nil) ;; :states 'motion
;; "SPC" nil)
(general-define-key
:keymaps '(diff-mode-map help-mode-map image-mode-map
dired-mode-map Man-mode-map eww-mode-map
magit-mode-map debugger-mode-map dired-mode-map
custom-mode-map eshell-mode-map
elfeed-show-mode-map elfeed-search-mode-map
image-mode-map help-mode-map)
:states 'normal
"SPC" nil)
(general-define-key
:keymaps 'magit-mode-map
:states 'visual
"SPC" nil)
(general-define-key
:keymaps '(diff-mode-map org-agenda-keymap org-agenda-mode-map)
:states 'motion
"SPC" nil)
(general-define-key
:keymaps 'eshell-mode-map
:states 'normal
"c" #'evil-backward-char
"t" #'evil-next-line
"s" #'evil-previous-line
"r" #'evil-forward-char)
(general-define-key
:keymaps 'evil-insert-state-map
"U" nil
"C-a" nil
"C-y" nil
"C-e" nil)
(general-define-key (general-define-key
:states 'normal :states 'normal
@ -5087,6 +5113,7 @@ Undefining some stuff to make keybind prefixes work correctly.
"hdk" #'helpful-key "hdk" #'helpful-key
"hdm" #'helpful-macro "hdm" #'helpful-macro
"hdM" #'helpful-mode "hdM" #'helpful-mode
"hdp" #'describe-package
"hds" #'helpful-symbol "hds" #'helpful-symbol
"hdv" #'helpful-variable "hdv" #'helpful-variable