diff --git a/ha-config.org b/ha-config.org index b463607..734c359 100644 --- a/ha-config.org +++ b/ha-config.org @@ -360,7 +360,7 @@ What text objects are known? - ~’~ :: a string, surround by quotes, also ~`~ for backticks - ~)~ :: parenthesis, also ~}~ and ~]~, see ~g~ - ~x~ :: within a brace, paren, etc., with the [[Better Parenthesis with Text Object][my extensions below]], see ~b~ and ~f~ for similar functionality. - - ~d~ :: a /defun/, or code block, similar to ~p~. + - ~f~ :: a /defun/, or code block, see [[file:ha-programming.org::*Evil Text Object from Tree Sitter][definition here]]. - ~i~ :: indention area, for YAML and Python, with the [[Text Objects based on Indentation][evil-indent-plus]] package - ~t~ :: an HTML tag - ~c~ :: for comments @@ -1541,9 +1541,20 @@ Magnar Sveen's [[https://github.com/magnars/expand-region.el][expand-region]] pr (use-package expand-region :bind ("C-=" . er/expand-region) + :config + (defun ha-start-region () + "Increase the region when on special characters." + (interactive) + (if (looking-at (rx (any "{}()[]"))) + (call-interactively 'er/expand-region) + (evil-visual-state))) + :general + (:states 'normal "v" 'ha-start-region) ;; Use escape to get out of visual mode, but hitting v again expands the selection. - (:states 'visual "v" 'er/expand-region)) + (:states 'visual + "v" 'er/expand-region + "V" 'er/contract-region)) #+end_src * Working Layout While editing any file on disk is easy enough, I like the mental context switch associated with a full-screen window frame showing all the buffers of a /project task/ (often a direct link to a repository project, but not always). diff --git a/ha-programming-elisp.org b/ha-programming-elisp.org index aa26ba9..5d7c72e 100644 --- a/ha-programming-elisp.org +++ b/ha-programming-elisp.org @@ -121,8 +121,11 @@ My primary use-case is for its refactoring and other unique features. For instan (use-package lispy :config (evil-define-key 'normal emacs-lisp-mode-map - "gf" 'lispy-ace-paren - "gF" 'lispy-ace-symbol) + ;; Use C-SPC to mark single letter, as these seem to be nicer expansions: + "v" 'lispy-mark-symbol ; Mark larger section at first? + "M-v" 'lispy-mark ; Mark entire s-expression + "g f" 'lispy-ace-paren + "g F" 'lispy-ace-symbol) (ha-elisp-leader "r i" '("cond→if" . lispy-to-ifs) @@ -173,7 +176,7 @@ Use the ~>~ key to /slurp/ in outside objects into the current expression… in :hook ((emacs-lisp-mode lisp-mode) . lispyville-mode)) #+end_src -Now +Now we need to define additional key movements: #+begin_src emacs-lisp (use-package lispyville :config @@ -202,7 +205,11 @@ Now "(" 'lispyville-previous-opening ")" 'lispyville-next-closing "{" 'lispyville-backward-up-list - "}" 'lispyville-next-opening) + "}" 'lispyville-next-opening + + "[ f" 'lispyville-beginning-of-defun + "] f" 'lispyville-beginning-of-next-defun + "] F" 'lispyville-end-of-next-defun) ;; Visually high-light a region, just hit `(' to wrap it in parens. ;; Without smartparens, we need to insert a pair of delimiters: