Add gy operator for yanking without indentation

Copies

   (a
    b
    c)

As

(a
 b
 c)
This commit is contained in:
Henrik Lissner 2019-10-10 12:32:33 -04:00
parent 9e3974d2f3
commit 07380af819
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 19 additions and 0 deletions

View file

@ -217,6 +217,19 @@ See `+evil/next-preproc-directive' for details."
(interactive "p")
(+evil/next-comment (- count)))
;;;###autoload (autoload '+evil:yank-unindented "editor/evil/autoload/evil" nil t)
(evil-define-operator +evil:yank-unindented (beg end type register yank-handler)
"Saves the (reindented) characters in motion into the kill-ring."
:move-point nil
:repeat nil
(interactive "<R><x><y>")
(let ((indent (save-excursion (goto-char beg) (current-indentation)))
(text (buffer-substring beg end)))
(with-temp-buffer
(insert text)
(indent-rigidly (point-min) (point-max) (- indent))
(evil-yank (point-min) (point-max)))))
;;
;;; wgrep