Type jk to enter Normal mode

This commit is contained in:
Howard Abrams 2025-12-05 14:07:22 -08:00
parent 038ec85e0e
commit ddd0dc9d0c

View file

@ -193,12 +193,29 @@ I am not a long term VI user, and dont have much need for any of its control
;; I have better window control: ;; I have better window control:
(kbd "C-w") 'sp-kill-region)) (kbd "C-w") 'sp-kill-region))
#+end_src #+end_src
** Evil Escape
I find that myself not noticing Im in /insert/ mode, and start typing =j= repeatedly to go down a line, and end up typing something like: =jjjjjjjjjjjj=.
To remedy this, Im using the [[https://www.emacswiki.org/emacs/KeyChord][KeyChord]] code:
#+BEGIN_SRC emacs-lisp :tangle no
(use-package key-chord
:config
(setq key-chord-two-keys-delay 0.1)
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
(key-chord-define evil-insert-state-map "kk" 'evil-normal-state)
(key-chord-mode 1))
#+END_SRC
** Evil Text Object Line ** Evil Text Object Line
Delete a line, ~d d~ is in basic VI. Since some commands use text objects, and the basic text object doesnt include lines, the [[https://github.com/emacsorphanage/evil-textobj-line][evil-textobj-line]] project adds that: Delete a line, ~d d~ is in basic VI. Since some commands use text objects, and the basic text object doesnt include lines, the [[https://github.com/emacsorphanage/evil-textobj-line][evil-textobj-line]] project adds that:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil-textobj-line) (use-package evil-textobj-line)
#+end_src #+end_src
Now ~v i l~ and ~v a l~ works as youd expect, but does this improve on ~S-v~? Now ~v i l~ selects the line without initial/trailing whitespace, and ~v a l~ selects the line with spaces, and ~S-v~ selects the line with the final carriage return. Is this much of an improvement? Well, wrapping a line in parenthesis, is just ~y s i l )~
** Text Objects based on Indentation ** Text Objects based on Indentation
The [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]] project creates text objects based on the indentation level, similar to how the ~b~ works with “blocks” of code. The [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]] project creates text objects based on the indentation level, similar to how the ~b~ works with “blocks” of code.
#+begin_src emacs-lisp #+begin_src emacs-lisp