[Emacs] Better define keybinds

Leader keys now override by default other keymaps

Better autoloaded keymaps’ support
This commit is contained in:
Lucien Cartier-Tilet 2021-11-07 15:54:20 +01:00
parent 2f81df2042
commit b801bcef27
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -713,15 +713,18 @@ can still feel some influence from my Spacemacs years here.
(general-auto-unbind-keys) (general-auto-unbind-keys)
:config :config
(general-create-definer phundrak/undefine (general-create-definer phundrak/undefine
:keymaps 'override
:states '(normal emacs)) :states '(normal emacs))
(general-create-definer phundrak/evil (general-create-definer phundrak/evil
:states '(normal)) :states '(normal))
(general-create-definer phundrak/leader-key (general-create-definer phundrak/leader-key
:states '(normal insert visual emacs) :states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" :prefix "SPC"
:global-prefix "C-SPC") :global-prefix "C-SPC")
(general-create-definer phundrak/major-leader-key (general-create-definer phundrak/major-leader-key
:states '(normal insert visual emacs) :states '(normal insert visual emacs)
:keymaps 'override
:prefix "," :prefix ","
:global-prefix "M-m")) :global-prefix "M-m"))
#+end_src #+end_src
@ -1206,31 +1209,31 @@ in this code block all my keybinds for Elfeed here.
:straight (:build t) :straight (:build t)
:init :init
(elfeed-goodies/setup) (elfeed-goodies/setup)
:config :general
(phundrak/undefine (phundrak/undefine
:keymaps '(elfeed-show-mode-map elfeed-search-mode-map) :keymaps '(elfeed-show-mode-map elfeed-search-mode-map)
"SPC" nil :packages 'elfeed
"DEL" nil "DEL" nil
"s" nil) "s" nil)
(phundrak/evil (phundrak/evil
:keymaps 'elfeed-show-mode-map :keymaps 'elfeed-show-mode-map
:packages 'elfeed
"+" #'elfeed-show-tag "+" #'elfeed-show-tag
"-" #'elfeed-show-untag "-" #'elfeed-show-untag
"o" #'elfeed-goodies/show-ace-link
"q" #'elfeed-kill-buffer)
(phundrak/evil
:keymaps 'elfeed-show-mode-map
"b" #'elfeed-show-visit "b" #'elfeed-show-visit
"C" #'elfeed-kill-link-url-at-point "C" #'elfeed-kill-link-url-at-point
"d" #'elfeed-show-save-enclosure "d" #'elfeed-show-save-enclosure
"l" #'elfeed-show-next-link "l" #'elfeed-show-next-link
"n" #'elfeed-show-next "n" #'elfeed-show-next
"o" #'elfeed-goodies/show-ace-link
"p" #'elfeed-show-prev "p" #'elfeed-show-prev
"q" #'elfeed-kill-buffer
"S" #'elfeed-show-new-live-search "S" #'elfeed-show-new-live-search
"u" #'elfeed-show-tag--unread "u" #'elfeed-show-tag--unread
"y" #'elfeed-show-yank) "y" #'elfeed-show-yank)
(phundrak/evil (phundrak/evil
:keymaps 'elfeed-search-mode-map :keymaps 'elfeed-search-mode-map
:packages 'elfeed
"«" #'elfeed-search-first-entry "«" #'elfeed-search-first-entry
"»" #'elfeed-search-last-entry "»" #'elfeed-search-last-entry
"b" #'elfeed-search-browse-url "b" #'elfeed-search-browse-url
@ -1246,6 +1249,7 @@ in this code block all my keybinds for Elfeed here.
"y" #'elfeed-search-yank) "y" #'elfeed-search-yank)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'elfeed-search-mode-map :keymaps 'elfeed-search-mode-map
:packages 'elfeed
"c" #'elfeed-db-compact "c" #'elfeed-db-compact
"t" '(nil :which-key "tag") "t" '(nil :which-key "tag")
"tt" #'elfeed-search-tag-all-unread "tt" #'elfeed-search-tag-all-unread
@ -1310,21 +1314,19 @@ configuration for the ~mu4e~ package itself.
(let ((dir "~/Downloads/mu4e")) (let ((dir "~/Downloads/mu4e"))
(when (file-directory-p dir) (when (file-directory-p dir)
(setq mu4e-attachment-dir dir)))) (setq mu4e-attachment-dir dir))))
:general
:config
<<mu4e-mail-service>>
<<mu4e-mail-on-machine>>
<<mu4e-no-signature>>
<<mu4e-bookmarks>>
;; Keybindings
<<mu4e-keybindings-undef>> <<mu4e-keybindings-undef>>
<<mu4e-keybindings-view>> <<mu4e-keybindings-view>>
<<mu4e-keybindings-header>> <<mu4e-keybindings-header>>
<<mu4e-keybindings-header-no-leader>> <<mu4e-keybindings-header-no-leader>>
<<mu4e-keybindings-message>> <<mu4e-keybindings-message>>
:config
<<mu4e-mail-service>>
<<mu4e-mail-on-machine>>
<<mu4e-no-signature>>
<<mu4e-bookmarks>>
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)) (imagemagick-register-types))
@ -1742,6 +1744,7 @@ bépo layout: ~hjkl~ becomes ~ctsr~ for us. Lets undefine some of these:
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(phundrak/undefine (phundrak/undefine
:keymaps 'mu4e-view-mode-map :keymaps 'mu4e-view-mode-map
:packages 'mu4e
"S" nil "S" nil
"r" nil "r" nil
"c" nil "c" nil
@ -1749,9 +1752,8 @@ bépo layout: ~hjkl~ becomes ~ctsr~ for us. Lets undefine some of these:
(phundrak/undefine (phundrak/undefine
:keymaps '(mu4e-view-mode-map mu4e-headers-mode-map) :keymaps '(mu4e-view-mode-map mu4e-headers-mode-map)
"SPC" nil :packages 'mu4e
"s" nil "s" nil)
"," nil)
#+end_src #+end_src
Now, lets define some keybindings for mu4es view mode, that is when Now, lets define some keybindings for mu4es view mode, that is when
@ -1799,6 +1801,7 @@ described with a simple function:
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'mu4e-view-mode-map :keymaps 'mu4e-view-mode-map
:packages 'mu4e
<<general-keybindings-gen(table=mu4e-keybindings-view-tbl)>>) <<general-keybindings-gen(table=mu4e-keybindings-view-tbl)>>)
#+end_src #+end_src
@ -1807,6 +1810,7 @@ Ill also declare two keybinds for mu4es headers mode.
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'mu4e-headers-mode-map :keymaps 'mu4e-headers-mode-map
:packages 'mu4e
"t" '(mu4e-view-mark-thread :which-key "mark thread") "t" '(mu4e-view-mark-thread :which-key "mark thread")
"s" 'swiper) "s" 'swiper)
#+end_src #+end_src
@ -1817,6 +1821,7 @@ move freely (remember, bépo layout for me).
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(phundrak/evil (phundrak/evil
:keymaps 'mu4e-headers-mode-map :keymaps 'mu4e-headers-mode-map
:packages 'mu4e
"c" #'evil-backward-char "c" #'evil-backward-char
"t" #'evil-next-line "t" #'evil-next-line
"s" #'evil-previous-line "s" #'evil-previous-line
@ -1840,6 +1845,7 @@ the major-mode leader and call a simple function.
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'message-mode-map :keymaps 'message-mode-map
:packages 'mu4e
<<general-keybindings-gen(table=mu4e-keybindings-message-tbl)>>) <<general-keybindings-gen(table=mu4e-keybindings-message-tbl)>>)
#+end_src #+end_src
@ -1879,8 +1885,10 @@ the major-mode leader and call a simple function.
(with-temp-buffer (with-temp-buffer
(insert-file-contents mail-signature-file) (insert-file-contents mail-signature-file)
(buffer-string)))))) (buffer-string))))))
:general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'org-msg-edit-mode-map :keymaps 'org-msg-edit-mode-map
:packages 'org-msg
"," #'message-send-and-exit "," #'message-send-and-exit
"c" #'message-send-and-exit "c" #'message-send-and-exit
"a" #'message-kill-buffer "a" #'message-kill-buffer
@ -1934,16 +1942,16 @@ configuration [[file:mpd.org][here]]).
((emms-source-file-default-directory (expand-file-name "~/Music")) ((emms-source-file-default-directory (expand-file-name "~/Music"))
(emms-player-mpd-server-name "localhost") (emms-player-mpd-server-name "localhost")
(emms-player-mpd-server-port "6600") (emms-player-mpd-server-port "6600")
(emms-player-mpd-music-directory (expand-file-name "~/Music")))) (emms-player-mpd-music-directory (expand-file-name "~/Music")))
:general
(phundrak/undefine (phundrak/undefine
:keymaps 'emms-browser-mode-map :keymaps 'emms-browser-mode-map
"SPC" nil :packages 'emms
"," nil
"s" nil "s" nil
"r" nil) "r" nil)
(phundrak/evil (phundrak/evil
:keymaps 'emms-browser-mode-map :keymaps 'emms-browser-mode-map
:packages 'emms
"a" #'emms-browser-add-tracks "a" #'emms-browser-add-tracks
"A" #'emms-browser-add-tracks-and-play "A" #'emms-browser-add-tracks-and-play
"b" '(nil :which-key "browse by") "b" '(nil :which-key "browse by")
@ -1961,28 +1969,31 @@ configuration [[file:mpd.org][here]]).
"q" #'kill-this-buffer) "q" #'kill-this-buffer)
(phundrak/evil (phundrak/evil
:keymaps 'emms-playlist-mode-map :keymaps 'emms-playlist-mode-map
:packages 'emms
"d" #'emms-playlist-mode-kill-track "d" #'emms-playlist-mode-kill-track
"p" #'emms-playlist-mode-play-smart "p" #'emms-playlist-mode-play-smart
"q" #'kill-this-buffer) "q" #'kill-this-buffer)
(phundrak/leader-key (phundrak/leader-key
"m" '(nil :which-key "media") :infix "m"
"m." #'hydra-media/body :packages 'emms
"m<" #'emms-player-mpd-previous "" '(nil :which-key "media")
"m«" #'emms-player-mpd-previous "." #'hydra-media/body
"m>" #'emms-player-mpd-next "<" #'emms-player-mpd-previous
"m»" #'emms-player-mpd-next "«" #'emms-player-mpd-previous
"mc" #'emms-player-mpd-clear ">" #'emms-player-mpd-next
"me" '(nil :which-key "emms") "»" #'emms-player-mpd-next
"meb" #'emms-browser "c" #'emms-player-mpd-clear
"mep" #'emms-playlist-mode-go "e" '(nil :which-key "emms")
"mes" #'emms-player-mpd-show "eb" #'emms-browser
"mp" '((lambda () "ep" #'emms-playlist-mode-go
"es" #'emms-player-mpd-show
"p" '((lambda ()
(interactive) (interactive)
(shell-command-and-echo "mpc toggle")) (shell-command-and-echo "mpc toggle"))
:which-key "mpc toggle") :which-key "mpc toggle")
"mu" '(nil :which-key "update") "u" '(nil :which-key "update")
"mum" #'emms-player-mpd-update-all "um" #'emms-player-mpd-update-all
"muc" #'emms-cache-set-from-mpd-all) "uc" #'emms-cache-set-from-mpd-all))
#+end_src #+end_src
I also want to create a small hydra for manipulating MPD: I also want to create a small hydra for manipulating MPD:
@ -2042,10 +2053,10 @@ reader?
:straight (:build t) :straight (:build t)
:defer t :defer t
:mode ("\\.epub\\'" . nov-mode) :mode ("\\.epub\\'" . nov-mode)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'nov-mode-map :keymaps 'nov-mode-map
"SPC" nil :packages 'nov
"c" #'nov-previous-document "c" #'nov-previous-document
"t" #'nov-scroll-up "t" #'nov-scroll-up
"C-d" #'nov-scroll-up "C-d" #'nov-scroll-up
@ -2059,6 +2070,7 @@ reader?
"gt" #'nov-goto-toc "gt" #'nov-goto-toc
"gv" #'nov-view-source "gv" #'nov-view-source
"gV" #'nov-view-content-source) "gV" #'nov-view-content-source)
:config
(setq nov-text-width 95)) (setq nov-text-width 95))
#+end_src #+end_src
@ -2078,18 +2090,16 @@ dark mode for PDFs.
:straight (:build t) :straight (:build t)
:mode (("\\.pdf\\'" . pdf-view-mode)) :mode (("\\.pdf\\'" . pdf-view-mode))
:hook (pdf-tools-enabled . pdf-view-midnight-minor-mode) :hook (pdf-tools-enabled . pdf-view-midnight-minor-mode)
:config :general
(phundrak/undefine
:keymaps 'pdf-view-mode-map
"SPC" nil
"," nil)
(phundrak/evil (phundrak/evil
:keymaps 'pdf-view-mode-map :keymaps 'pdf-view-mode-map
:packages 'pdf-tools
"y" #'pdf-view-kill-ring-save "y" #'pdf-view-kill-ring-save
"t" #'evil-collection-pdf-view-next-line-or-next-page "t" #'evil-collection-pdf-view-next-line-or-next-page
"s" #'evil-collection-pdf-view-previous-line-or-previous-page) "s" #'evil-collection-pdf-view-previous-line-or-previous-page)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'pdf-view-mode-map :keymaps 'pdf-view-mode-map
:packages 'pdf-tools
"a" '(nil :which-key "annotations") "a" '(nil :which-key "annotations")
"aD" #'pdf-annot-delete "aD" #'pdf-annot-delete
"at" #'pdf-annot-attachment-dired "at" #'pdf-annot-attachment-dired
@ -2114,6 +2124,7 @@ dark mode for PDFs.
"o" 'pdf-outline "o" 'pdf-outline
"m" 'pdf-view-midnight-minor-mode) "m" 'pdf-view-midnight-minor-mode)
:config
(with-eval-after-load 'pdf-view (with-eval-after-load 'pdf-view
(setq pdf-view-midnight-colors '("#d8dee9" . "#2e3440")))) (setq pdf-view-midnight-colors '("#d8dee9" . "#2e3440"))))
#+end_src #+end_src
@ -2152,36 +2163,34 @@ doing and what Git is doing! In short, I absolutely love it!
:defer t :defer t
: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)
:config :general
(phundrak/undefine (:keymaps '(git-rebase-mode-map)
:keymaps '(magit-blame-read-only-mode-map magit-mode-map magit-diff-mode-map) :packages 'magit
:states '(normal visual emacs)
"SPC" nil)
(general-define-key
: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)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'git-rebase-mode-map :keymaps 'git-rebase-mode-map
:packages 'magit
"," #'with-editor-finish "," #'with-editor-finish
"k" #'with-editor-cancel "k" #'with-editor-cancel
"a" #'with-editor-cancel) "a" #'with-editor-cancel)
(phundrak/leader-key (phundrak/leader-key
:states 'normal :infix "g"
"g" '(nil :wk "git") :packages 'magit
"gb" #'magit-blame "" '(nil :wk "git")
"gc" #'magit-clone "b" #'magit-blame
"gd" #'magit-dispatch "c" #'magit-clone
"gi" #'magit-init "d" #'magit-dispatch
"gs" #'magit-status "i" #'magit-init
"gy" #'my/yadm "s" #'magit-status
"gS" #'magit-stage-file "y" #'my/yadm
"gU" #'magit-unstage-file "S" #'magit-stage-file
"gf" '(nil :wk "file") "U" #'magit-unstage-file
"gfd" #'magit-diff "f" '(nil :wk "file")
"gfc" #'magit-file-checkout "fd" #'magit-diff
"gfl" #'magit-file-dispatch "fc" #'magit-file-checkout
"gfF" #'magit-find-file)) "fl" #'magit-file-dispatch
"fF" #'magit-find-file))
#+end_src #+end_src
[[https://github.com/alphapapa][Alphapapa]] also created an awesome package for Magit: magit-todos which [[https://github.com/alphapapa][Alphapapa]] also created an awesome package for Magit: magit-todos which
@ -2409,10 +2418,12 @@ region or in a whole buffer.
(use-package iedit (use-package iedit
:defer t :defer t
:straight (:build t) :straight (:build t)
:config :general
(phundrak/leader-key (phundrak/leader-key
"r" '(nil :which-key "refactor") :infix "r"
"ri" #'iedit-mode)) :packages 'iedit
"" '(nil :which-key "refactor")
"i" #'iedit-mode))
#+end_src #+end_src
Since Im using evil, Ill also use a compatibility package that adds Since Im using evil, Ill also use a compatibility package that adds
@ -2426,11 +2437,7 @@ states for iedit.
:init :init
(setq iedit-curent-symbol-default t (setq iedit-curent-symbol-default t
iedit-only-at-symbol-boundaries t iedit-only-at-symbol-boundaries t
iedit-toggle-key-default nil) iedit-toggle-key-default nil))
:config
(phundrak/undefine
:keymaps 'evil-iedit-state-map
"SPC" nil))
#+end_src #+end_src
*** Parinfer *** Parinfer
@ -2526,15 +2533,14 @@ me.
:straight (:type built-in) :straight (:type built-in)
:defer t :defer t
:hook (dired-mode . turn-on-gnus-dired-mode) :hook (dired-mode . turn-on-gnus-dired-mode)
:config :general
(phundrak/undefine
:keymaps 'dired-mode-map
"SPC" nil)
(phundrak/evil (phundrak/evil
:keymaps 'dired-mode-map :keymaps 'dired-mode-map
:packages 'dired
"(" #'dired-hide-details-mode "(" #'dired-hide-details-mode
"n" #'evil-next-line "n" #'evil-next-line
"p" #'evil-previous-line) "p" #'evil-previous-line)
:config
(setq dired-dwim-target t (setq dired-dwim-target t
dired-recursive-copies t dired-recursive-copies t
dired-recursive-deletes t dired-recursive-deletes t
@ -2553,9 +2559,10 @@ that are for some reason not included in dired yet.
:straight (:type built-in) :straight (:type built-in)
:after dired :after dired
:commands (dired-jump dired-jump-other-window dired-omit-mode) :commands (dired-jump dired-jump-other-window dired-omit-mode)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'dired-mode-map :keymaps 'dired-mode-map
:packages 'dired-x
"«" #'dired-omit-mode)) "«" #'dired-omit-mode))
#+end_src #+end_src
@ -2567,9 +2574,10 @@ time to get the actual size of a directory.
(use-package dired-du (use-package dired-du
:after dired :after dired
:straight (:build t) :straight (:build t)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'dired-mode-map :keymaps 'dired-mode-map
:packages 'dired-du
"»" #'dired-du-mode)) "»" #'dired-du-mode))
#+end_src #+end_src
@ -2582,10 +2590,12 @@ tree. And by default, I want ~dired-git-info~ to hide file details.
:after (dired) :after (dired)
:straight (:build t) :straight (:build t)
:hook (dired-after-reading . dired-git-info-auto-enable) :hook (dired-after-reading . dired-git-info-auto-enable)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'dired-mode-map :keymaps 'dired-mode-map
:packages 'dired-git-info
")" #'dired-git-info-mode) ")" #'dired-git-info-mode)
:config
(setq dgi-auto-hide-details-p t)) (setq dgi-auto-hide-details-p t))
#+end_src #+end_src
@ -2634,16 +2644,17 @@ compilation buffer, as well as enable some syntax highlighting.
(defun colorize-compilation-buffer () (defun colorize-compilation-buffer ()
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max)))) (ansi-color-apply-on-region (point-min) (point-max))))
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'compilation-mode-map :keymaps 'compilation-mode-map
"g" nil "g" nil
"r" #'recompile "r" #'recompile
"h" nil) "h" nil)
(setq compilation-scroll-output t))
(phundrak/leader-key (phundrak/leader-key
"R" #'recompile) "R" #'recompile)
:config
(setq compilation-scroll-output t))
#+end_src #+end_src
*** Eshell *** Eshell
@ -2657,7 +2668,7 @@ though.
(use-package eshell (use-package eshell
:defer t :defer t
:straight (:type built-in :build t) :straight (:type built-in :build t)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'eshell-mode-map :keymaps 'eshell-mode-map
"c" #'evil-backward-char "c" #'evil-backward-char
@ -2669,6 +2680,7 @@ though.
:states 'insert :states 'insert
"C-a" #'eshell-bol "C-a" #'eshell-bol
"C-e" #'end-of-line) "C-e" #'end-of-line)
:config
<<eshell-alias-file>> <<eshell-alias-file>>
<<eshell-concat-shell-command>> <<eshell-concat-shell-command>>
<<eshell-alias-open>> <<eshell-alias-open>>
@ -2889,11 +2901,7 @@ Lets define some more intuitive keybinds for ~info-mode~.
(use-package info (use-package info
:defer t :defer t
:straight (info :type built-in :build t) :straight (info :type built-in :build t)
:config :general
(phundrak/undefine
:keymaps 'Info-mode-map
"SPC" nil
"," nil)
(phundrak/evil (phundrak/evil
:keymaps 'Info-mode-map :keymaps 'Info-mode-map
"c" #'Info-prev "c" #'Info-prev
@ -2973,9 +2981,10 @@ to ~p~ since it would conflict with my main ~general~ prefix.
:straight (bufler :build t :straight (bufler :build t
:files (:defaults (:exclude "helm-bufler.el"))) :files (:defaults (:exclude "helm-bufler.el")))
:defer t :defer t
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'bufler-list-mode-map :keymaps 'bufler-list-mode-map
:packages 'bufler
"?" #'hydra:bufler/body "?" #'hydra:bufler/body
"g" #'bufler "g" #'bufler
"f" #'bufler-list-group-frame "f" #'bufler-list-group-frame
@ -3052,10 +3061,6 @@ extended however we like!
:init :init
(auto-fill-mode -1) (auto-fill-mode -1)
:config :config
(phundrak/undefine
:keymaps '(org-agenda-keymap org-agenda-mode-map)
:states '(normal motion emacs)
"SPC" nil)
<<org-hydra-babel>> <<org-hydra-babel>>
(require 'ox-beamer) (require 'ox-beamer)
(setq org-hide-leading-stars nil (setq org-hide-leading-stars nil
@ -3096,11 +3101,14 @@ extended however we like!
<<org-html-validation>> <<org-html-validation>>
<<org-latex-classes>> <<org-latex-classes>>
<<org-publish-projects>> <<org-publish-projects>>
:general
(phundrak/evil (phundrak/evil
:keymaps 'org-mode-map :keymaps 'org-mode-map
:packages 'org
"RET" 'org-open-at-point) "RET" 'org-open-at-point)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'org-mode-map :keymaps 'org-mode-map
:packages 'org
<<general-keybindings-gen(table=org-keybinds-various)>> <<general-keybindings-gen(table=org-keybinds-various)>>
<<general-keybindings-gen(table=org-keybinds-babel)>> <<general-keybindings-gen(table=org-keybinds-babel)>>
<<general-keybindings-gen(table=org-keybinds-dates)>> <<general-keybindings-gen(table=org-keybinds-dates)>>
@ -3110,6 +3118,7 @@ extended however we like!
<<general-keybindings-gen(table=org-keybinds-toggles)>>) <<general-keybindings-gen(table=org-keybinds-toggles)>>)
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'org
:keymaps 'org-src-mode-map :keymaps 'org-src-mode-map
"'" #'org-edit-src-exit "'" #'org-edit-src-exit
"k" #'org-edit-src-abort)) "k" #'org-edit-src-abort))
@ -3346,13 +3355,15 @@ files.
:type git :type git
:host github :host github
:repo "jakebox/preview-org-html-mode") :repo "jakebox/preview-org-html-mode")
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'org-mode-map :keymaps 'org-mode-map
"P" '(:ignore :which-key "preview") :packages 'preview-org-html-mode
"Ph" #'preview-org-html-mode :infix "P"
"Pr" #'preview-org-html-refresh "" '(:ignore :which-key "preview")
"Pp" #'preview-org-html-pop-window-to-frame) "h" #'preview-org-html-mode
"r" #'preview-org-html-refresh
"p" #'preview-org-html-pop-window-to-frame)
:config :config
(setq preview-org-html-refresh-configuration 'save)) (setq preview-org-html-refresh-configuration 'save))
#+end_src #+end_src
@ -3871,14 +3882,17 @@ The project is then defined like so:
bibtex-completion-library-path "~/org/bibliography/bibtex-pdfs/" bibtex-completion-library-path "~/org/bibliography/bibtex-pdfs/"
bibtex-completion-pdf-symbol "⌘" bibtex-completion-pdf-symbol "⌘"
bibtex-completion-notes-symbol "✎") bibtex-completion-notes-symbol "✎")
:general
(phundrak/evil (phundrak/evil
:keymaps 'bibtex-mode-map :keymaps 'bibtex-mode-map
:packages 'org-ref
"C-t" #'org-ref-bibtex-next-entry "C-t" #'org-ref-bibtex-next-entry
"C-s" #'org-ref-bibtex-previous-entry "C-s" #'org-ref-bibtex-previous-entry
"gt" #'org-ref-bibtex-next-entry "gt" #'org-ref-bibtex-next-entry
"gs" #'org-ref-bibtex-previous-entry) "gs" #'org-ref-bibtex-previous-entry)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps '(bibtex-mode-map) :keymaps '(bibtex-mode-map)
:packages 'org-ref
;; Navigation ;; Navigation
"t" #'org-ref-bibtex-next-entry "t" #'org-ref-bibtex-next-entry
"s" #'org-ref-bibtex-previous-entry "s" #'org-ref-bibtex-previous-entry
@ -3901,6 +3915,7 @@ The project is then defined like so:
"lp" #'pubmed-insert-bibtex-from-pmid) "lp" #'pubmed-insert-bibtex-from-pmid)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'org-mode-map :keymaps 'org-mode-map
:pakages 'org-ref
"ic" #'org-ref-insert-link)) "ic" #'org-ref-insert-link))
#+end_src #+end_src
@ -3910,9 +3925,10 @@ The project is then defined like so:
:straight (:build t) :straight (:build t)
:config :config
(setq bibtex-completion-pdf-open-function #'find-file) (setq bibtex-completion-pdf-open-function #'find-file)
:general
(phundrak/leader-key (phundrak/leader-key
:keymaps '(bibtex-mode-map) :keymaps '(bibtex-mode-map)
:packages 'ivy-bibtex
"m" #'ivy-bibtex)) "m" #'ivy-bibtex))
#+end_src #+end_src
@ -3959,16 +3975,14 @@ which is really nice! However, most of my configuration will be stolen
:after org :after org
:defer t :defer t
:straight (:build t) :straight (:build t)
:config :general
(phundrak/undefine
:keymaps 'org-present-mode-map
"SPC" nil
"," nil)
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'org-present
:keymaps 'org-mode-map :keymaps 'org-mode-map
"p" #'org-present) "p" #'org-present)
(phundrak/evil (phundrak/evil
:states 'normal :states 'normal
:packages 'org-present
:keymaps 'org-present-mode-keymap :keymaps 'org-present-mode-keymap
"+" #'org-present-big "+" #'org-present-big
"-" #'org-present-small "-" #'org-present-small
@ -4100,8 +4114,9 @@ icons!
:host github :host github
:type git :type git
:repo "Townk/org-ol-tree") :repo "Townk/org-ol-tree")
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'org-ol-tree
:keymaps 'org-mode-map :keymaps 'org-mode-map
"O" #'org-ol-tree)) "O" #'org-ol-tree))
#+end_src #+end_src
@ -4116,14 +4131,16 @@ icons!
:defer t :defer t
:after org :after org
:straight (:build t) :straight (:build t)
:init
(phundrak/evil
:keymaps 'org-mode-map
"<f8>" #'org-tree-slide-mode)
:config :config
(setq org-tree-slide-skip-done nil) (setq org-tree-slide-skip-done nil)
:general
(phundrak/evil
:keymaps 'org-mode-map
:packages 'org-tree-slide
"<f8>" #'org-tree-slide-mode)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'org-tree-slide-mode-map :keymaps 'org-tree-slide-mode-map
:packages 'org-tree-slide
"d" (lambda () (interactive (setq org-tree-slide-skip-done (not org-tree-slide-skip-done)))) "d" (lambda () (interactive (setq org-tree-slide-skip-done (not org-tree-slide-skip-done))))
"p" #'org-tree-slide-move-next-tree "p" #'org-tree-slide-move-next-tree
"n" #'org-tree-slide-move-previous-tree "n" #'org-tree-slide-move-previous-tree
@ -4231,9 +4248,10 @@ I also want all the visual enhancements LSP can provide.
(lsp-ui-peek-always-show t) (lsp-ui-peek-always-show t)
(lsp-ui-sideline-show-hover t) (lsp-ui-sideline-show-hover t)
(lsp-ui-doc-enable t) (lsp-ui-doc-enable t)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'lsp-ui-peek-mode-map :keymaps 'lsp-ui-peek-mode-map
:packages 'lsp-ui
"c" #'lsp-ui-pook--select-prev-file "c" #'lsp-ui-pook--select-prev-file
"t" #'lsp-ui-pook--select-next "t" #'lsp-ui-pook--select-next
"s" #'lsp-ui-pook--select-prev "s" #'lsp-ui-pook--select-prev
@ -4268,7 +4286,7 @@ And lets enable some intergration with ~ivy~.
:defer t :defer t
:after lsp :after lsp
:straight (:build t) :straight (:build t)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'lsp-mode-map :keymaps 'lsp-mode-map
[remap xref-find-apropos] #'consult-lsp-symbols)) [remap xref-find-apropos] #'consult-lsp-symbols))
@ -4409,9 +4427,10 @@ unfortunately.
("\\.mdk\\'" . markdown-mode) ("\\.mdk\\'" . markdown-mode)
("\\.mdx\\'" . markdown-mode)) ("\\.mdx\\'" . markdown-mode))
:hook (markdown-mode . orgtbl-mode) :hook (markdown-mode . orgtbl-mode)
:config :general
(phundrak/evil (phundrak/evil
:keymaps 'markdown-mode-map :keymaps 'markdown-mode-map
:packages 'markdown-mode
"M-RET" #'markdown-insert-list-item "M-RET" #'markdown-insert-list-item
"M-c" #'markdown-promote "M-c" #'markdown-promote
"M-t" #'markdown-move-down "M-t" #'markdown-move-down
@ -4419,6 +4438,7 @@ unfortunately.
"M-r" #'markdown-demote) "M-r" #'markdown-demote)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'markdown-mode-map :keymaps 'markdown-mode-map
:packages 'markdown-mode
"{" #'markdown-backward-paragraph "{" #'markdown-backward-paragraph
"}" #'markdown-forward-paragraph "}" #'markdown-forward-paragraph
"]" #'markdown-complete "]" #'markdown-complete
@ -4491,6 +4511,7 @@ unfortunately.
"xP" #'markdown-pre-region "xP" #'markdown-pre-region
"xs" #'markdown-insert-strike-through "xs" #'markdown-insert-strike-through
"xq" #'markdown-blockquote-region) "xq" #'markdown-blockquote-region)
:config
(setq markdown-fontify-code-blocks-natively t)) (setq markdown-fontify-code-blocks-natively t))
#+end_src #+end_src
@ -4501,8 +4522,9 @@ able to render Markdown through its API.
:defer t :defer t
:after markdown-mode :after markdown-mode
:straight (:build t) :straight (:build t)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'gh-md
:keymaps 'markdown-mode-map :keymaps 'markdown-mode-map
"cr" #'gh-md-render-buffer)) "cr" #'gh-md-render-buffer))
#+end_src #+end_src
@ -4514,8 +4536,9 @@ with the ~toc-org~ package for org-mode.
:defer t :defer t
:after markdown-mode :after markdown-mode
:straight (:build t) :straight (:build t)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'markdown-toc
:keymaps 'markdown-mode-map :keymaps 'markdown-mode-map
"iT" #'markdown-toc-generate-toc)) "iT" #'markdown-toc-generate-toc))
#+end_src #+end_src
@ -4528,8 +4551,9 @@ Markdown file quickly. Thats neat!
:after markdown-mode :after markdown-mode
:straight (:build t) :straight (:build t)
:custom ((vmd-binary-path (executable-find "vmd"))) :custom ((vmd-binary-path (executable-find "vmd")))
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'vmd-mode
:keymaps 'markdown-mode-map :keymaps 'markdown-mode-map
"cP" #'vmd-mode)) "cP" #'vmd-mode))
#+end_src #+end_src
@ -4569,12 +4593,14 @@ Nginx syntax.
:mode ("{{.\\(pum\\|puml\\)\\'" . plantuml-mode) :mode ("{{.\\(pum\\|puml\\)\\'" . plantuml-mode)
:init :init
(add-to-list 'org-babel-load-languages '(plantuml . t)) (add-to-list 'org-babel-load-languages '(plantuml . t))
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'plantuml-mode-map :keymaps 'plantuml-mode-map
:packages 'plantuml-mode
"c" '(nil :which-key "compile") "c" '(nil :which-key "compile")
"cc" #'plantuml-preview "cc" #'plantuml-preview
"co" #'plantuml-set-output-type) "co" #'plantuml-set-output-type)
:config
(setq plantuml-default-exec-mode 'jar (setq plantuml-default-exec-mode 'jar
plantuml-jar-path "~/.local/bin/plantuml.jar" plantuml-jar-path "~/.local/bin/plantuml.jar"
org-plantuml-jar-path "~/.local/bin/plantuml.jar")) org-plantuml-jar-path "~/.local/bin/plantuml.jar"))
@ -4635,9 +4661,9 @@ still somewhat related, and Emacs thinks so too.
(put 'c-c++-backend 'safe-local-variable 'symbolp) (put 'c-c++-backend 'safe-local-variable 'symbolp)
:config :config
(require 'compile) (require 'compile)
:general
(phundrak/undefine (phundrak/undefine
:keymaps '(c-mode-map c++-mode-map) :keymaps '(c-mode-map c++-mode-map)
"," nil
";" nil) ";" nil)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps '(c-mode-map c++-mode-map) :keymaps '(c-mode-map c++-mode-map)
@ -4683,6 +4709,7 @@ update its fontlock.
:config :config
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'stumpwm-mode-map :keymaps 'stumpwm-mode-map
:packages 'stumpwm-mode
"e" '(:ignore :which-key "eval") "e" '(:ignore :which-key "eval")
"ee" #'stumpwm-eval-last-sexp "ee" #'stumpwm-eval-last-sexp
"ed" #'stumpwm-eval-defun "ed" #'stumpwm-eval-defun
@ -4731,7 +4758,6 @@ Lets also declare some Elisp-dedicated keybindings, prefixed by a
comma. comma.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(phundrak/major-leader-key (phundrak/major-leader-key
general-define-key
:keymaps 'emacs-lisp-mode-map :keymaps 'emacs-lisp-mode-map
"'" #'ielm "'" #'ielm
"c" '(emacs-lisp-byte-compile :which-key "Byte compile") "c" '(emacs-lisp-byte-compile :which-key "Byte compile")
@ -4765,6 +4791,7 @@ comma.
;; :init ;; :init
;; (setq lua-indent-level 2 ;; (setq lua-indent-level 2
;; lua-indent-string-contents t) ;; lua-indent-string-contents t)
;; :general
;; (phundrak/major-leader-key ;; (phundrak/major-leader-key
;; :keymaps lua-mode-map ;; :keymaps lua-mode-map
;; "'" #'lua-show-process-buffer ;; "'" #'lua-show-process-buffer
@ -4831,16 +4858,19 @@ comma.
pytest-pdb-module) pytest-pdb-module)
:config :config
(add-to-list 'pytest-project-root-files "setup.cfg") (add-to-list 'pytest-project-root-files "setup.cfg")
:general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'python-mode-map :keymaps 'python-mode-map
"t" '(:ignore :which-key "test") :infix "t"
"ta" #'python-pytest :packages 'pytest
"tf" #'python-pytest-file-dwim "" '(:ignore :which-key "test")
"tF" #'python-pytest-file "a" #'python-pytest
"tt" #'python-pytest-function-dwim "f" #'python-pytest-file-dwim
"tT" #'python-pytest-function "F" #'python-pytest-file
"tr" #'python-pytest-repeat "t" #'python-pytest-function-dwim
"tp" #'python-pytest-dispatch)) "T" #'python-pytest-function
"r" #'python-pytest-repeat
"p" #'python-pytest-dispatch))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4872,18 +4902,20 @@ comma.
pipenv-uninstall) pipenv-uninstall)
:hook (python-mode . pipenv-mode) :hook (python-mode . pipenv-mode)
:init (setq pipenv-with-projectile nil) :init (setq pipenv-with-projectile nil)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'python-mode-map :keymaps 'python-mode-map
"e" '(:ignore :which-key "pipenv") :packages 'pipenv
"ea" #'pipenv-activate :infix "e"
"ed" #'pipenv-deactivate "" '(:ignore :which-key "pipenv")
"ei" #'pipenv-install "a" #'pipenv-activate
"el" #'pipenv-lock "d" #'pipenv-deactivate
"eo" #'pipenv-open "i" #'pipenv-install
"er" #'pipenv-run "l" #'pipenv-lock
"es" #'pipenv-shell "o" #'pipenv-open
"eu" #'pipenv-uninstall)) "r" #'pipenv-run
"s" #'pipenv-shell
"u" #'pipenv-uninstall))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4904,20 +4936,23 @@ comma.
:straight (:build t) :straight (:build t)
:if (executable-find "pyenv") :if (executable-find "pyenv")
:commands (pyenv-mode-versions) :commands (pyenv-mode-versions)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'pyenv-mode
:keymaps 'python-mode-map :keymaps 'python-mode-map
"vu" #'pyenv-mode-unset :infix "v"
"vs" #'pyenv-mode-set)) "u" #'pyenv-mode-unset
"s" #'pyenv-mode-set))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package pippel (use-package pippel
:defer t :defer t
:straight (:build t) :straight (:build t)
:init :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'python-mode-map :keymaps 'python-mode-map
:packages 'pippel
"P" #'pippel-list-packages)) "P" #'pippel-list-packages))
#+end_src #+end_src
@ -4925,24 +4960,28 @@ comma.
(use-package pyimport (use-package pyimport
:defer t :defer t
:straight (:build t) :straight (:build t)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:packages 'pyimport
:keymaps 'python-mode-map :keymaps 'python-mode-map
"i" '(:ignore :which-key "imports") :infix "i"
"ii" #'pyimport-insert-missing "" '(:ignore :which-key "imports")
"ir" #'pyimport-remove-unused)) "i" #'pyimport-insert-missing
"r" #'pyimport-remove-unused))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package py-isort (use-package py-isort
:defer t :defer t
:straight (:build t) :straight (:build t)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'python-mode-map :keymaps 'python-mode-map
"i" '(:ignore :which-key "imports") :packages 'py-isort
"is" #'py-isort-buffer :infix "i"
"iR" #'py-isort-region)) "" '(:ignore :which-key "imports")
"s" #'py-isort-buffer
"R" #'py-isort-region))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4957,11 +4996,14 @@ comma.
:straight (:build t) :straight (:build t)
:init :init
(add-hook 'python-mode-hook #'sphinx-doc-mode) (add-hook 'python-mode-hook #'sphinx-doc-mode)
:general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'python-mode-map :keymaps 'python-mode-map
"S" '(:ignore :which-key "sphinx-doc") :packages 'sphinx-doc
"Se" #'sphinx-doc-mode :infix "S"
"Sd" #'sphinx-doc)) "" '(:ignore :which-key "sphinx-doc")
"e" #'sphinx-doc-mode
"d" #'sphinx-doc))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4971,10 +5013,13 @@ comma.
:mode "\\.p\\(yx\\|x[di]\\)\\'" :mode "\\.p\\(yx\\|x[di]\\)\\'"
:config :config
(setq cython-default-compile-format "cython -a %s") (setq cython-default-compile-format "cython -a %s")
:general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'cython-mode-map :keymaps 'cython-mode-map
"c" '(:ignore :which-key "cython") :packages 'cython-mode
"cc" #'cython-compile)) :infix "c"
"" '(:ignore :which-key "cython")
"c" #'cython-compile))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -5016,13 +5061,15 @@ development. First, lets install the most important package,
(after! org-src (after! org-src
(defalias 'org-babel-execute:rust #'org-babel-execute:rustic) (defalias 'org-babel-execute:rust #'org-babel-execute:rustic)
(add-to-list 'org-src-lang-modes '("rust" . rustic))) (add-to-list 'org-src-lang-modes '("rust" . rustic)))
:config :general
(general-define-key (general-define-key
:keymaps 'rustic-mode-map :keymaps 'rustic-mode-map
:packages 'lsp
"M-t" #'lsp-ui-imenu "M-t" #'lsp-ui-imenu
"M-?" #'lsp-find-references) "M-?" #'lsp-find-references)
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'rustic-mode-map :keymaps 'rustic-mode-map
:packages 'rustic
"b" '(:ignore :which-key "build") "b" '(:ignore :which-key "build")
"bb" #'rustic-cargo-build "bb" #'rustic-cargo-build
"bB" #'rustic-cargo-bench "bB" #'rustic-cargo-bench
@ -5042,6 +5089,7 @@ development. First, lets install the most important package,
"t" '(:ignore :which-key "cargo test") "t" '(:ignore :which-key "cargo test")
"ta" #'rustic-cargo-test "ta" #'rustic-cargo-test
"tt" #'rustic-cargo-current-test) "tt" #'rustic-cargo-current-test)
:config
(setq rustic-indent-method-chain t (setq rustic-indent-method-chain t
rustic-babel-format-src-block nil rustic-babel-format-src-block nil
rustic-format-trigger nil) rustic-format-trigger nil)
@ -5113,9 +5161,10 @@ development. First, lets install the most important package,
("\\.svelte\\'" . web-mode) ("\\.svelte\\'" . web-mode)
("\\.ctp\\'" . web-mode) ("\\.ctp\\'" . web-mode)
("\\.djhtml\\'" . web-mode)) ("\\.djhtml\\'" . web-mode))
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps 'web-mode-map :keymaps 'web-mode-map
:packages 'web-mode
"=" '(nil :which-key "format") "=" '(nil :which-key "format")
"E" '(nil :which-key "errors") "E" '(nil :which-key "errors")
"El" #'web-mode-dom-errors-show "El" #'web-mode-dom-errors-show
@ -5164,9 +5213,10 @@ development. First, lets install the most important package,
:hook (css-mode . smartparens-mode) :hook (css-mode . smartparens-mode)
:init :init
(put 'css-indent-offset 'safe-local-variable #'integerp) (put 'css-indent-offset 'safe-local-variable #'integerp)
:config :general
(phundrak/major-leader-key (phundrak/major-leader-key
:keymaps '(css-mode-map) :keymaps 'css-mode-map
:packages 'css-mode
"=" '(:ignore :wk "format") "=" '(:ignore :wk "format")
"g" '(:ignore :wk "goto"))) "g" '(:ignore :wk "goto")))
#+end_src #+end_src
@ -5429,7 +5479,9 @@ configuration to make it bépo-compatible.
:straight t :straight t
:config :config
(setq avy-keys '(?a ?u ?i ?e ?c ?t ?s ?r ?n)) (setq avy-keys '(?a ?u ?i ?e ?c ?t ?s ?r ?n))
:general
(phundrak/evil (phundrak/evil
:packages 'avy
"gl" #'avy-goto-line)) "gl" #'avy-goto-line))
#+end_src #+end_src
@ -5542,32 +5594,6 @@ which resolution to play a YouTube video in an external video player.
:END: :END:
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
(phundrak/undefine
:keymaps '(Buffer-menu-mode-map
Info-mode-map
Man-mode-map
backtrace-mode-map
custom-mode-map
debugger-mode-map
diff-minor-mode-map
diff-mode-map
electric-help-map
epa-key-list-mode-map
eshell-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
"," nil)
(general-define-key (general-define-key
:keymaps 'global-map :keymaps 'global-map
"<mouse-2>" nil "<mouse-2>" nil