Create local leaders for various modes
This way, SPC-m will always be special for each major mode ... something like that.
This commit is contained in:
parent
effc1cc551
commit
ad7125ad64
7 changed files with 56 additions and 39 deletions
|
@ -320,9 +320,9 @@ The =en= script is used as the last pipe entry on the command line, this display
|
|||
* Keybindings
|
||||
Along with kicking off the org-capture, I want to be able to clock-in and out:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal org-mode-map
|
||||
:prefix "SPC m"
|
||||
"X" 'org-capture
|
||||
(with-eval-after-load 'ha-org
|
||||
(ha-org-leader
|
||||
"X" '("org capture" . org-capture)
|
||||
"c" '(:ignore t :which-key "clocks")
|
||||
"c i" '("clock in" . org-clock-in)
|
||||
"c l" '("clock in last" . org-clock-in-last)
|
||||
|
@ -336,7 +336,7 @@ Along with kicking off the org-capture, I want to be able to clock-in and out:
|
|||
"c R" '("clock report" . org-clock-report)
|
||||
"c t" '("eval range" . org-evaluate-time-range)
|
||||
"c =" '("timestamp up" . org-clock-timestamps-up)
|
||||
"c -" '("timestamp down" . org-clock-timestamps-down))
|
||||
"c -" '("timestamp down" . org-clock-timestamps-down)))
|
||||
#+END_SRC
|
||||
|
||||
* Technical Artifacts :noexport:
|
||||
|
|
|
@ -347,7 +347,11 @@ I'm not trying an experiment where specially-placed function keys on my fancy er
|
|||
:keymaps '(normal visual)
|
||||
:prefix "SPC"
|
||||
:non-normal-prefix "M-SPC"
|
||||
:global-prefix "<f13>"))
|
||||
:global-prefix "<f13>")
|
||||
|
||||
(general-create-definer ha-local-leader
|
||||
:states '(normal visual)
|
||||
:prefix "SPC m"))
|
||||
#+END_SRC
|
||||
*** Top-Level Operations
|
||||
Let's try this general "space" prefix by defining some top-level operations, including hitting ~space~ twice to bring up the =M-x= collection of functions:
|
||||
|
|
|
@ -626,8 +626,8 @@ The gods ordained that Mail and Org should dance together, so step one is compos
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org-mime
|
||||
:config
|
||||
(general-evil-define-key 'normal notmuch-message-mode-map
|
||||
:prefix "SPC m"
|
||||
(ha-local-leader
|
||||
:keymaps 'notmuch-message-mode-map
|
||||
"s" '("send" . notmuch-mua-send-and-exit)
|
||||
"m" '("mime it" . org-mime-htmlize)))
|
||||
#+END_SRC
|
||||
|
|
|
@ -165,9 +165,8 @@ The heavy lifting, however is done by this function. Note that I will need anoth
|
|||
* Keybinding to Paste into Org Files
|
||||
We just need to bind it to the /local/ mode key sequence:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal org-mode-map
|
||||
:prefix "SPC m"
|
||||
"y" 'ha-org-yank-clipboard)
|
||||
(with-eval-after-load 'ha-org
|
||||
(ha-org-leader "y" 'ha-org-yank-clipboard))
|
||||
#+END_SRC
|
||||
|
||||
* Technical Artifacts :noexport:
|
||||
|
|
|
@ -165,18 +165,18 @@ Another helper function for the content of website is to make sure to update =in
|
|||
* Keybindings
|
||||
Make it easy to publish all or just some of my website:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal org-mode-map
|
||||
:prefix "SPC m"
|
||||
(with-eval-after-load 'ha-org
|
||||
(ha-org-leader
|
||||
"p" '(:ignore t :which-key "publishing")
|
||||
"p a" '("all" . org-publish-all)
|
||||
"p p" '("project" . org-publish-project))
|
||||
"p p" '("project" . org-publish-project)))
|
||||
#+END_SRC
|
||||
|
||||
And let's put a /leader key/ sequence for my favorite file on my website:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(ha-leader
|
||||
"f h" '(:ignore t :which-key "howards")
|
||||
"f h w" '("website index" . (lambda ()
|
||||
"f h i" '("website index" . (lambda ()
|
||||
(find-file (expand-file-name "index.org" "~/website")))))
|
||||
#+END_SRC
|
||||
* Technical Artifacts :noexport:
|
||||
|
|
15
ha-org.org
15
ha-org.org
|
@ -33,16 +33,28 @@ Org is a /large/ complex beast with a gazillion settings, so I discuss these lat
|
|||
:init
|
||||
<<variables>>
|
||||
<<org-todo>>
|
||||
|
||||
:config
|
||||
<<ha-org-leader>>
|
||||
<<visual-hook>>
|
||||
<<text-files>>
|
||||
<<org-font-lock>>
|
||||
<<no-flycheck-in-org>>
|
||||
<<ob-languages>>
|
||||
<<ox-exporters>>
|
||||
<<org-return-key>>
|
||||
<<global-keybindings>>
|
||||
<<org-keybindings>>)
|
||||
#+END_SRC
|
||||
|
||||
One other helper routine is a =general= macro for org-mode files:
|
||||
#+NAME: ha-org-leader
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(general-create-definer ha-org-leader
|
||||
:states '(normal visual)
|
||||
:keymaps 'org-mode-map
|
||||
:prefix "SPC m")
|
||||
#+END_SRC
|
||||
* Initialization Section
|
||||
Org is an important part of my Emacs world, and with a lot of customization (even though Spacemacs and Doom do a good job getting things started).
|
||||
|
||||
|
@ -314,8 +326,7 @@ Keybindings available to all file buffers:
|
|||
Bindings specific to org files:
|
||||
#+NAME: org-keybindings
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(general-evil-define-key 'normal org-mode-map
|
||||
:prefix "SPC m"
|
||||
(ha-org-leader
|
||||
"e" '("exports" . org-export-dispatch)
|
||||
"l" '("insert link" . org-insert-link)
|
||||
"o" '("goto link" . ace-link-org)
|
||||
|
|
|
@ -26,6 +26,14 @@ A literate programming file for helping me program.
|
|||
* Introduction
|
||||
|
||||
Seems that all programming interfaces and workflows behave similarly. However...
|
||||
|
||||
One other helper routine is a =general= macro for org-mode files:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-create-definer ha-prog-leader
|
||||
:states '(normal visual)
|
||||
:keymaps 'prog-mode-map
|
||||
:prefix "SPC m")
|
||||
#+END_SRC
|
||||
* General
|
||||
The following work for all programming languages.
|
||||
** direnv
|
||||
|
@ -125,15 +133,12 @@ I like =comment-dwim= (~M-;~), and I like =comment-box=, but I have an odd perso
|
|||
#+END_SRC
|
||||
And a keybinding:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal prog-mode-map
|
||||
:prefix "SPC m"
|
||||
"c" '("comment line" . ha-comment-line))
|
||||
(ha-prog-leader "c" '("comment line" . ha-comment-line))
|
||||
#+END_SRC
|
||||
** Evaluation
|
||||
Typical keybindings for all programming modes:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal prog-mode-map
|
||||
:prefix "SPC m"
|
||||
(ha-prog-leader
|
||||
"e" '(:ignore t :which-key "eval")
|
||||
"e ;" '("expression" . eval-expression)
|
||||
"e b" '("buffer" . eval-buffer)
|
||||
|
@ -206,8 +211,7 @@ And, finally, we install [[https://github.com/k1LoW/emacs-ansible][Ansible]] as
|
|||
#+END_SRC
|
||||
And some special keybindings to encrypt/decrypt files:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal ansible-mode-map
|
||||
:prefix "SPC m"
|
||||
(ha-prog-leader
|
||||
"x" '(:ignore t :which-key "decryption")
|
||||
"x d" '("decrypt buffer" . ansible-decrypt-buffer)
|
||||
"x e" '("encrypt buffer" . ansible-encrypt-buffer))
|
||||
|
@ -288,8 +292,7 @@ finds at that point."
|
|||
And we just need to bind it. The following is Doom-specific:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-evil-define-key 'normal prog-mode-map
|
||||
:prefix "SPC m"
|
||||
(ha-prog-leader
|
||||
"e c" '("current" . ha-eval-current-expression))
|
||||
#+END_SRC
|
||||
*** Dim those Parenthesis
|
||||
|
|
Loading…
Reference in a new issue