From 4cb8b4a83712cc65ae9a826b7719530c1ece52b2 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Thu, 23 Oct 2025 17:30:41 -0400 Subject: in line evil text object --- .config/emacs/init.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to '.config/emacs/init.el') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 0799189..015855c 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -189,6 +189,21 @@ (define-key evil-window-map (kbd "C-g") #'evil-keyboard-quit) (define-key evil-operator-state-map (kbd "C-g") #'evil-keyboard-quit)) +;; Custom "in-line" text object +(evil-define-text-object evil-inner-line (count &optional beg end type) + "Select the current line excluding leading/trailing whitespace." + (let* ((line-start (line-beginning-position)) + (line-end (line-end-position)) + (text (buffer-substring-no-properties line-start line-end)) + (nonspace-start (string-match-p "\\S-" text)) + (nonspace-end (or (save-match-data + (string-match-p "\\S-\\s-*\\'" text)) + 0))) + (evil-range (+ line-start nonspace-start) + (+ line-start nonspace-end) + 'exclusive))) +(define-key evil-inner-text-objects-map "l" 'evil-inner-line) + ;; == style ;; theme ;; (use-package dracula-theme -- cgit v1.2.3