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
|
* Keybindings
|
||||||
Along with kicking off the org-capture, I want to be able to clock-in and out:
|
Along with kicking off the org-capture, I want to be able to clock-in and out:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal org-mode-map
|
(with-eval-after-load 'ha-org
|
||||||
:prefix "SPC m"
|
(ha-org-leader
|
||||||
"X" 'org-capture
|
"X" '("org capture" . org-capture)
|
||||||
"c" '(:ignore t :which-key "clocks")
|
"c" '(:ignore t :which-key "clocks")
|
||||||
"c i" '("clock in" . org-clock-in)
|
"c i" '("clock in" . org-clock-in)
|
||||||
"c l" '("clock in last" . org-clock-in-last)
|
"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 R" '("clock report" . org-clock-report)
|
||||||
"c t" '("eval range" . org-evaluate-time-range)
|
"c t" '("eval range" . org-evaluate-time-range)
|
||||||
"c =" '("timestamp up" . org-clock-timestamps-up)
|
"c =" '("timestamp up" . org-clock-timestamps-up)
|
||||||
"c -" '("timestamp down" . org-clock-timestamps-down))
|
"c -" '("timestamp down" . org-clock-timestamps-down)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Technical Artifacts :noexport:
|
* 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)
|
:keymaps '(normal visual)
|
||||||
:prefix "SPC"
|
:prefix "SPC"
|
||||||
:non-normal-prefix "M-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
|
#+END_SRC
|
||||||
*** Top-Level Operations
|
*** 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:
|
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
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package org-mime
|
(use-package org-mime
|
||||||
:config
|
:config
|
||||||
(general-evil-define-key 'normal notmuch-message-mode-map
|
(ha-local-leader
|
||||||
:prefix "SPC m"
|
:keymaps 'notmuch-message-mode-map
|
||||||
"s" '("send" . notmuch-mua-send-and-exit)
|
"s" '("send" . notmuch-mua-send-and-exit)
|
||||||
"m" '("mime it" . org-mime-htmlize)))
|
"m" '("mime it" . org-mime-htmlize)))
|
||||||
#+END_SRC
|
#+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
|
* Keybinding to Paste into Org Files
|
||||||
We just need to bind it to the /local/ mode key sequence:
|
We just need to bind it to the /local/ mode key sequence:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal org-mode-map
|
(with-eval-after-load 'ha-org
|
||||||
:prefix "SPC m"
|
(ha-org-leader "y" 'ha-org-yank-clipboard))
|
||||||
"y" 'ha-org-yank-clipboard)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Technical Artifacts :noexport:
|
* Technical Artifacts :noexport:
|
||||||
|
|
|
@ -165,18 +165,18 @@ Another helper function for the content of website is to make sure to update =in
|
||||||
* Keybindings
|
* Keybindings
|
||||||
Make it easy to publish all or just some of my website:
|
Make it easy to publish all or just some of my website:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal org-mode-map
|
(with-eval-after-load 'ha-org
|
||||||
:prefix "SPC m"
|
(ha-org-leader
|
||||||
"p" '(:ignore t :which-key "publishing")
|
"p" '(:ignore t :which-key "publishing")
|
||||||
"p a" '("all" . org-publish-all)
|
"p a" '("all" . org-publish-all)
|
||||||
"p p" '("project" . org-publish-project))
|
"p p" '("project" . org-publish-project)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
And let's put a /leader key/ sequence for my favorite file on my website:
|
And let's put a /leader key/ sequence for my favorite file on my website:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(ha-leader
|
(ha-leader
|
||||||
"f h" '(:ignore t :which-key "howards")
|
"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")))))
|
(find-file (expand-file-name "index.org" "~/website")))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Technical Artifacts :noexport:
|
* 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
|
:init
|
||||||
<<variables>>
|
<<variables>>
|
||||||
<<org-todo>>
|
<<org-todo>>
|
||||||
|
|
||||||
:config
|
:config
|
||||||
|
<<ha-org-leader>>
|
||||||
<<visual-hook>>
|
<<visual-hook>>
|
||||||
<<text-files>>
|
<<text-files>>
|
||||||
<<org-font-lock>>
|
<<org-font-lock>>
|
||||||
<<no-flycheck-in-org>>
|
<<no-flycheck-in-org>>
|
||||||
<<ob-languages>>
|
<<ob-languages>>
|
||||||
|
<<ox-exporters>>
|
||||||
<<org-return-key>>
|
<<org-return-key>>
|
||||||
<<global-keybindings>>
|
<<global-keybindings>>
|
||||||
<<org-keybindings>>)
|
<<org-keybindings>>)
|
||||||
#+END_SRC
|
#+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
|
* 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).
|
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:
|
Bindings specific to org files:
|
||||||
#+NAME: org-keybindings
|
#+NAME: org-keybindings
|
||||||
#+BEGIN_SRC emacs-lisp :tangle no
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
(general-evil-define-key 'normal org-mode-map
|
(ha-org-leader
|
||||||
:prefix "SPC m"
|
|
||||||
"e" '("exports" . org-export-dispatch)
|
"e" '("exports" . org-export-dispatch)
|
||||||
"l" '("insert link" . org-insert-link)
|
"l" '("insert link" . org-insert-link)
|
||||||
"o" '("goto link" . ace-link-org)
|
"o" '("goto link" . ace-link-org)
|
||||||
|
|
|
@ -26,6 +26,14 @@ A literate programming file for helping me program.
|
||||||
* Introduction
|
* Introduction
|
||||||
|
|
||||||
Seems that all programming interfaces and workflows behave similarly. However...
|
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
|
* General
|
||||||
The following work for all programming languages.
|
The following work for all programming languages.
|
||||||
** direnv
|
** direnv
|
||||||
|
@ -125,15 +133,12 @@ I like =comment-dwim= (~M-;~), and I like =comment-box=, but I have an odd perso
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
And a keybinding:
|
And a keybinding:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal prog-mode-map
|
(ha-prog-leader "c" '("comment line" . ha-comment-line))
|
||||||
:prefix "SPC m"
|
|
||||||
"c" '("comment line" . ha-comment-line))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Evaluation
|
** Evaluation
|
||||||
Typical keybindings for all programming modes:
|
Typical keybindings for all programming modes:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal prog-mode-map
|
(ha-prog-leader
|
||||||
:prefix "SPC m"
|
|
||||||
"e" '(:ignore t :which-key "eval")
|
"e" '(:ignore t :which-key "eval")
|
||||||
"e ;" '("expression" . eval-expression)
|
"e ;" '("expression" . eval-expression)
|
||||||
"e b" '("buffer" . eval-buffer)
|
"e b" '("buffer" . eval-buffer)
|
||||||
|
@ -206,8 +211,7 @@ And, finally, we install [[https://github.com/k1LoW/emacs-ansible][Ansible]] as
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
And some special keybindings to encrypt/decrypt files:
|
And some special keybindings to encrypt/decrypt files:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal ansible-mode-map
|
(ha-prog-leader
|
||||||
:prefix "SPC m"
|
|
||||||
"x" '(:ignore t :which-key "decryption")
|
"x" '(:ignore t :which-key "decryption")
|
||||||
"x d" '("decrypt buffer" . ansible-decrypt-buffer)
|
"x d" '("decrypt buffer" . ansible-decrypt-buffer)
|
||||||
"x e" '("encrypt buffer" . ansible-encrypt-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:
|
And we just need to bind it. The following is Doom-specific:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(general-evil-define-key 'normal prog-mode-map
|
(ha-prog-leader
|
||||||
:prefix "SPC m"
|
|
||||||
"e c" '("current" . ha-eval-current-expression))
|
"e c" '("current" . ha-eval-current-expression))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** Dim those Parenthesis
|
*** Dim those Parenthesis
|
||||||
|
|
Loading…
Reference in a new issue