Today I want to talk briefly about some packages for GNU Emacs which I have recently installed and integrated into my daily work-flow. Consider this a series of short mini-reviews.
Eno is conceptually similar to AceJump and avy, in that it allows you to quickly jump to any word, symbol, line, parenthesis, string, and so on. However, it does more than simply move the point within a buffer. For each
eno-*-goto command there additional commands to copy, cut, and paste. For example, I could use
eno-line-goto followed by
C-k to kill a line. Or I could simply use
eno-line-cut, which accomplishes the same thing in a single command.
Eno comes with a lot of commands which you must bind yourself. Hydra would be useful for simplifying that process along with making it easier to remember which command you have bound to which key. Personally, however, I use guide-key in conjunction with eno. My long list of bindings for eno looks like this:
(use-package eno :config (bind-keys ("C-s-n a". eno-word-goto) ("C-s-n b". eno-word-copy) ("C-s-n c". eno-word-cut) ("C-s-n d". eno-word-paste) ("C-s-n e". eno-symbol-goto) ("C-s-n f". eno-symbol-copy) ;; 30 lines omitted… ("M-s-n q". eno-word-cut-to-inline) ("M-s-n r". eno-word-paste-to-inline) ("M-s-n s". eno-url-open) ("M-s-n t". eno-clear-overlay)))
I haven’t memorized all of those bindings, nor do I intend to. Instead I use guide-key like so:
(use-package guide-key :config (setq guide-key/recursive-key-sequence-flag t) (setq guide-key/guide-key-sequence '("C-s-n" "M-s-n")) (guide-key-mode 1))
Update: Joost recommend in a comment below that I try which-key instead of guide-key. After using which-key for about sixty seconds I decided it was superior to guide-key, and strongly recommend it. Thanks Joost!
This way whenever I press
M-s-n I get a nice menu bar on the right side of my screen that shows the rest of the bindings. I recommend eno for quickly navigating and editing ‘things’ simulatenously in a buffer, but I strongly recommend using eno together with a package like guide-key or Hydra or helm-descbinds to help you remember what keys you have bound to the eno commands.
I mentioned avy in the previous section. Like eno it allows you to quickly and easily jump to things within a buffer, like a line, word, character, and so on. When all I want to do is navigate to a specific point I have found avy to be more useful than eno. This is because avy is better when it comes to narrowing down your search. For example,
avy-goto-word-1 lets you enter the first character of a word you’re searching for; it will then highlight all words that begining with that character, assigning each a single character you can press to choose the word to which you wish to jump. I find this to be faster, more effective, and straight-up easier to use than the eno’s corresponding
If all you want is fast movement to words, lines, etc., then I recommend avy over eno.
Modalka is ‘Yet Another Package’ which provides modal editing for Emacs. However, what distinguishes Modalka from similar packages is that it gives you fine control over exactly when and where you want to use modal editing. For example, Modalka binds no keys by default. That means it does nothing right out of the box, but the great benefit to that is Modalka allows you to integrate just the right amount of modal functionality you want. Basically it works like this:
Bind a key to
modalka-modeor (in my case)
modalka-global-modeso that you can toggle modal editing as needed.
Then use functions like
modalka-define-kbdto create key-bindings for when you’re doing modal editing.
Here’s an excerpt from my own configuration:
(modalka-define-kbd "a" "C-a") (modalka-define-kbd "e" "C-e") (modalka-define-kbd "p" "C-p") (modalka-define-kbd "n" "C-n") (modalka-define-kbd "v" "C-v") (modalka-define-kbd "V" "M-v") (modalka-define-kbd "w" "C-w") (modalka-define-kbd "y" "C-y") (modalka-define-kbd "W" "M-w") (modalka-define-kbd "Y" "M-y") (modalka-define-kbd "SPC" "C-SPC") (modalka-define-kbd "q" "M-q") (modalka-define-kbd ";" "M-;") (modalka-define-kbd "/" "C-/") (modalka-define-kbd "=" "C-=") (modalka-define-kbd "o" "C-o") (modalka-define-kbd "x b" "C-x C-b") (modalka-define-kbd "x f" "C-x C-f") (modalka-define-kbd "x s" "C-x C-s") (modalka-define-kbd "x 0" "C-x 0") (modalka-define-kbd "x 1" "C-x 1") (modalka-define-kbd "x 2" "C-x 2") (modalka-define-kbd "x o" "C-x o")
Whenever Modalka is active I can press
V to scroll up and down as if using
M-v, respectively. And note how I can use two character sequences to
x 2 and
x o for fast window management.
If you’ve wanted to try modal editing in Emacs but don’t want to use packages that come with pre-defined bindings then Modalka is a terrific way to get your feet wet and ease into modal editing at your own pace.
Finally I want to mention highlight-thing, a minor mode that highlights whatever thing is under the point, where ‘thing’ in this context refers to the builtin
thingatpt package. Personally I find highlight-thing useful in programming because if my cursor is over, say, a variable, then it quickly highlights all other uses of that variable throughout the code; you can even restrict the highlighting to the current function if you like. It’s a minor thing, no doubt, but something which I’ve found to help me more easily read the code I work on.