From 2d41285097a77578a6ee97611fd463cf0ca5e515 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Tue, 16 Jul 2024 08:27:36 -0700 Subject: [PATCH] Tidy up prose on evil and headers --- ha-config.org | 2 +- ha-evil.org | 13 +++++++++---- ha-programming-elisp.org | 2 +- ha-programming.org | 10 +++++----- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ha-config.org b/ha-config.org index 997dc01..22aa2d8 100644 --- a/ha-config.org +++ b/ha-config.org @@ -109,7 +109,7 @@ This package is /called outside of Emacs/, so I bound a keybinding to iCanHazSho When you type ~C-c C-c~ to close a window, it /doesn’t always/ paste back into the original window, but the text is saved to the clipboard, a quick paste works. And now, I don’t scream when I need to use those Electron apps, like Slack and Discord. -** Indexed Menu Navigation +** Indexed Menu Navigation (imenu) I’ve often called =imenu= to easily jump to a function definition in a file (or header in an org file), but after reading [[http://yummymelon.com/devnull/til-imenu.html][this essay]] by Charles Choi, I decided to increase =imenu='s utility. diff --git a/ha-evil.org b/ha-evil.org index df510f2..88337d3 100644 --- a/ha-evil.org +++ b/ha-evil.org @@ -27,9 +27,10 @@ A literate programming file for configuring Evil mode in Emacs. * Introduction As a grizzled veteran of the Emacs-VI Wars, I’ve decided to take advantage of both by using VI keybindings on top of Emacs. However, after thirty years of Emacs, my interface follows different goals: + - Most buffers begin in Evil’s /normal state/, e.g. normal mode for VIers. - - Pressing ~i~ or ~a~ jumps into a state of total Emacs, with the exception of ~Escape~ going back to Evil. This means, that while typing ~C-p~ goes up a line, and doesn’t auto-complete. - - I don’t use ~:~ and instead use ~M-x~ or better yet, ~SPC SPC~ (typing the space key twice). + - Pressing ~i~ or ~a~ jumps into a state of total Emacs, with the exception of ~Escape~ going back to Evil. This means, that typing ~C-p~ goes up a line, and doesn’t auto-complete. + - I don’t use ~:~ and instead use ~M-x~ or better yet, ~SPC SPC~ (typing the space key twice) from [[file:ha-general.org][General project]]. - The ~Space~ doesn’t advance a letter, but instead displays a tree of highly-customized functions, displayable at the bottom of my screen, e.g. [[file:screenshots/ha-leader.png]] @@ -38,6 +39,8 @@ Some advice that I followed: - [[https://github.com/noctuid/evil-guide][Evil Guide]] - [[https://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-config.html][A Vim-like Emacs Configuration from Nathan Typanski]] - [[https://stackoverflow.com/questions/25542097/emacs-evil-mode-how-to-change-insert-state-to-emacs-state-automatically][Evil insert state is really Emacs?]] Real answer to that is to set [[help:evil-disable-insert-state-bindings][evil-disable-insert-state-bindings]] + +TODO: Rebind the ~z~ keys * Evil-Specific Keybindings I split the configuration of Evil mode into sections. First, global settings: #+begin_src emacs-lisp @@ -109,7 +112,7 @@ I’m not a long term VI user, and I generally like /easy keys/, e.g. ~w~, have ;; Note that evil-backward-word-end is on the `g e': #+end_src -Testing: +In other words, with the above settings in place, ~w~ and ~e~ should jump from front to back of the entire line, but ~W~ and ~E~ should stop as /subword/: - =word-subword-subword= - =word_subword_subword= @@ -136,7 +139,7 @@ Keybindings I would like to use more: - ~xa`~ :: a back quoted string - ~xi`~ :: inner back quoted string - *Note:* The ~x~ in the above examples are /operations/, e.g. ~d~ for /delete,/ ~v~ for /select,/ ~y~ for /copy/ and ~c~ for /change/. +*NOTE:* The ~x~ in the above examples are /operations/, e.g. ~d~ for /delete,/ ~v~ for /select,/ ~y~ for /copy/ and ~c~ for /change/. What text objects are known? - ~w~ :: word @@ -154,6 +157,8 @@ What text objects are known? - ~u~ :: for URLs, really? Useful much? - ~a~ :: function arguments (probably a lot like symbol, ~o~), but the ~a~ can include commas. This comes from [[https://github.com/wcsmith/evil-args][evil-args]] extension (see below). +TODO: Search for a plugin, like [[https://github.com/coderifous/textobj-word-column.vim][textobj-word-column]] for text objects based on “columns”. + I am not a long term VI user, and don’t have much need for any of its control sequences (well, not all), so I made the following more Emacsy. I’ll admit, I like ~C-v~ (and use that all the time), so I need to futz around with the scrolling: #+begin_src emacs-lisp diff --git a/ha-programming-elisp.org b/ha-programming-elisp.org index c3b5bcb..55887b2 100644 --- a/ha-programming-elisp.org +++ b/ha-programming-elisp.org @@ -302,7 +302,7 @@ The idea of stealing some of Clojure Mode’s refactoring is brilliant (see [[ht ", r <" '("to thread first" . clojure-first-last-all))) #+end_src * Evaluation -** Eval Current Expression +** Eval Current Expression with eros The [[https://github.com/xiongtx/eros][eros]] package stands for Evaluation Result OverlayS for Emacs Lisp, and basically shows what each s-expression is near the cursor position instead of in the mini-buffer at the bottom of the window. #+begin_src emacs-lisp (use-package eros diff --git a/ha-programming.org b/ha-programming.org index 44925bb..87ff5a9 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -544,14 +544,14 @@ Once upon a time, we use to create a =TAGS= file that contained the database for #+end_src I have two different /jumping/ systems, the [[info:emacs#Xref][Xref interface]] and Evil’s. While comparable goals, they are behave different. Let’s compare evil keybindings: - | ~M-.~ | ~g .~ | [[help:xref-find-definitions][xref-find-definitions]] (also ~g d~ for [[help:evil-goto-definition][evil-goto-definition]])† | - | | ~g >~ | =xref-find-definitions-other-window= | + | ~M-.~ | ~g .~ | [[help:xref-find-definitions][xref-find-definitions]] (also ~g d~ for [[help:evil-goto-definition][evil-goto-definition]])† | + | | ~g >~ | =xref-find-definitions-other-window= | | ~M-,~ | ~g ,~ | [[help:xref-go-back][xref-go-back]] (see [[help:xref-pop-marker-stack][xref-pop-marker-stack]]) | | ~C-M-,~ | ~g <~ | [[help:xref-go-forward][xref-go-forward]] (kinda like =xref-find-definitions=) | - | ~M-?~ | ~g /~ | [[help:xref-find-references][xref-find-references]] to go from definition to code calls‡ | - | | ~g ?~ | [[help:xref-find-references-and-replace][xref-find-references-and-replace]] could be more accurate than [[*iEdit][iEdit]]. | + | ~M-?~ | ~g /~ | [[help:xref-find-references][xref-find-references]] to go from definition to code calls‡ | + | | ~g ?~ | [[help:xref-find-references-and-replace][xref-find-references-and-replace]] could be more accurate than [[*iEdit][iEdit]]. | | ~C-M-.~ | ~g h~ | [[help:xref-find-apropos][xref-find-apropos]] … doesn’t work well without LSP | - | ~C-TAB~ | | perform completion around point (also ~M-TAB~), see [[file:ha-config.org::*Auto Completion][Auto Completion]]. | + | ~C-TAB~ | | perform completion around point (also ~M-TAB~), see [[file:ha-config.org::*Auto Completion][Auto Completion]]. | † Prefix to prompt for the term \ ‡ If it finds more than one definition, Emacs displays the [[info:emacs#Xref Commands][*xref* buffer]], allowing you to select the definition.