diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2023-05-22 21:50:20 +0100 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2023-05-22 23:23:14 +0200 |
| commit | c3ae7ef6a4d43dd950dcaf846239dd8705c7364b (patch) | |
| tree | d0fa718c30321f1f167ac352a258a87fec83e5f4 /evil-commands.el | |
| parent | 6e22e2b7f353f16df5e117ab220d89c0450b44b9 (diff) | |
Re-indent last line join if onto blank
Diffstat (limited to 'evil-commands.el')
| -rw-r--r-- | evil-commands.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/evil-commands.el b/evil-commands.el index 0a340a1..f8cf142 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -1844,12 +1844,17 @@ Add (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode) to your init file f (evil-define-operator evil-join (beg end) "Join the selected lines." :motion evil-line - (let ((count (count-lines beg end))) + (let ((count (count-lines beg end)) + last-line-blank) (when (> count 1) (setq count (1- count))) (goto-char beg) - (dotimes (_ count) - (join-line 1)))) + (dotimes (i count) + (when (= (1+ i) count) ; i.e. we're just before the last join + (evil-move-beginning-of-line) + (setq last-line-blank (looking-at "[ \t]*$"))) + (join-line 1)) + (and last-line-blank (indent-according-to-mode)))) (evil-define-operator evil-join-whitespace (beg end) "Join the selected lines without changing whitespace. |
