diff --git a/ha-config.org b/ha-config.org index 939da74..293f75f 100644 --- a/ha-config.org +++ b/ha-config.org @@ -390,12 +390,20 @@ Can we change Evil at this point? Some tips: (let ((mode (make-symbol (format "%s-mode" name)))) (add-to-list 'evil-emacs-state-modes mode))) - ;; Use escape to get out of visual mode, eh? + ;; Use escape to get out of visual mode, but hitting v again expands the selection. (evil-define-key 'visual global-map (kbd "v") 'er/expand-region) (evil-mode)) #+END_SRC +While I’m pretty good with the VIM keybindings, I would like to play around with the text objects and how it compares to others (including the surround), for instance: + - ~diw~ :: deletes a word, but can be anywhere in it, while ~de~ deletes to the end of the word. + - ~daw~ :: deletes a word, plus the surrounding space, but not punctuation. + - ~xi,w~ :: changes a word that is snake or camel-cased, as in programming languages. The ~x~ can be ~c~ to change, ~d~ to delete, ~y~ to copy, etc. + - ~xis~ :: changes a /sentence,/ and if ~i~ is ~a~, it gets rid of the surrounding whitespace as well. Probably ~das~ and ~cis~. + - ~xip~ :: changes a /paragraph/. + - Surrounding punctuation, like quotes, parenthesis, brackets, etc. Also work, so ~ci)~ changes all the parameters to a function call. + Using the key-chord project allows me to make Escape be on two key combo presses on both sides of my keyboard: #+BEGIN_SRC emacs-lisp (use-package key-chord @@ -901,7 +909,7 @@ The [[https://github.com/oantolin/embark/][embark]] project offers /actions/ on #+END_SRC ** Evil Snipe -Doom introduced me to [[https://github.com/hlissner/evil-snipe][evil-snipe]] which is similar to =f= and =t=, but does two characters, and can, when configured, search more than the current line: +Doom introduced me to [[https://github.com/hlissner/evil-snipe][evil-snipe]] which is similar to =f= and =t=, but does two characters, and can, when configured, search more than the current line. When I use it, I stop and analyze to see the two characters to work on, so I’ve changed from the default, single ~s~, to ~g s~ so as not to get it confused with the =evil-surround=. #+BEGIN_SRC emacs-lisp (use-package evil-snipe @@ -909,45 +917,53 @@ Doom introduced me to [[https://github.com/hlissner/evil-snipe][evil-snipe]] whi :init (setq evil-snipe-scope 'visible) :config - (evil-define-key '(normal motion operator visual) - "s" #'evil-snipe-s - "S" #'evil-snipe-S) - (evil-snipe-mode +1)) + (evil-define-key '(normal motion operator visual) global-map + "gs" #'evil-snipe-s + "gS" #'evil-snipe-S)) #+END_SRC - It highlights all potential matches, use ~;~ to skip to the next match, and ~,~ to jump back. ** Evil Surround -I like both [[https://github.com/emacs-evil/evil-surround][evil-surround]] and Henrik's [[https://github.com/hlissner/evil-snipe][evil-snipe]], however, they both start with ~s~, and conflict, and getting them to work together means I have to remember when does ~s~ call sniper and when calls surround. As an original Emacs person, I am not bound by that key history, but I do need them consistent: +I like both [[https://github.com/emacs-evil/evil-surround][evil-surround]] and Henrik's [[https://github.com/hlissner/evil-snipe][evil-snipe]], however, they both start with ~s~, and conflict, and getting them to work together means I have to remember when does ~s~ call sniper and when calls surround. As an original Emacs person, I am not bound by that key history, but I do need them consistent, so I’m choosing the ~s~ to be /surround/. + #+BEGIN_SRC emacs-lisp (use-package evil-surround :after evil-snipe :config - (evil-define-key '(normal motion operator visual) evil-surround-mode-map - "z" 'evil-surround-edit - "Z" 'evil-Surround-edit) + (push '(?\" . ("“" . "”")) evil-surround-pairs-alist) + (push '(?\' . ("‘" . "’")) evil-surround-pairs-alist) + (push '(?\` . ("`" . "'")) evil-surround-pairs-alist) + (push '(?b . ("*" . "*")) evil-surround-pairs-alist) + (push '(?* . ("*" . "*")) evil-surround-pairs-alist) + (push '(?i . ("/" . "/")) evil-surround-pairs-alist) + (push '(?/ . ("/" . "/")) evil-surround-pairs-alist) + (push '(?= . ("=" . "=")) evil-surround-pairs-alist) + (push '(?~ . ("~" . "~")) evil-surround-pairs-alist) :hook (text-mode . evil-surround-mode)) ; Don't globally use it on Magit, et. al #+END_SRC Notes: - - ~cz'"~ :: to convert surrounding single quote string to double quotes. - - ~dz"~ :: to delete the surrounding double quotes. - - ~yze"~ :: puts single quotes around the next word. - - ~yZ$
~ :: surrouds the line with HTML =
= tag (with extra carriage returns). + - ~cs({~ :: to convert surrounding parens to curly braces. + - ~ds"~ :: to delete the surrounding *double* quotes. + - ~yse"~ :: puts double quotes around the next word… but only if you are at the beginning of the word, otherwise, + - ~ysiw'~ :: puts single quotes around the word, no matter where the point is positioned. + - ~yS$
~ :: surrouds the line with HTML =
= tag (with extra carriage returns).
- ~(~ :: puts spaces /inside/ the surrounding parens, but ~)~ doesn't. Same with ~[~ and ~]~.
** Jump, Jump, Jump!
-While I grew up on =Control S=, I am liking the /mental model/ associated with the [[https://github.com/abo-abo/avy][avy project]] that allows a /jump/ among matches across all visible windows. I use the ~F18~ key on my keyboard that should be easy to use.
+While I grew up on =Control S=, I am liking the /mental model/ associated with the [[https://github.com/abo-abo/avy][avy project]] that allows a /jump/ among matches across all visible windows. I use the ~F18~ key on my keyboard that should be easy to use, but ~g o~ seems obvious.
#+BEGIN_SRC emacs-lisp
-(use-package avy
- :init
- (setq avy-all-windows t
- avy-single-candidate-jump t
- avy-orders-alist
- '((avy-goto-char . avy-order-closest)
- (avy-goto-word-0 . avy-order-closest)))
- :config (ha-leader "j" '("jump" . avy-goto-char-timer))
- :bind ("