0

Evil-unimpaired (https://github.com/zmaas/evil-unimpaired/) tries to replicate vim-unimpaired, but the paste behaviour is just a dumbed down version of the original. The evil-unimpaired behaviour on [p:

(defun evil-unimpaired-paste-below ()
  (interactive)
  (evil-insert-newline-below)
  (evil-paste-after 1 evil-this-register))

It just inserts a newline and then pastes the register content. It doesn't care whether register content has a newline or not. It just inserts a new line anyway. Let's say I have the following text and I copy the second line with yy:

first line
   |second line

When I paste with [p it becomes

first line
    second line
    
   |second line

which is not a desirable output. Compare it to vim-unimpaired behaviour:

first line
   |second line

Paste with [p

first line
    second line
   |second line

The same problem applies to ]p which is supposed to paste text above current line. I want to know if there is a existing solution or can someone show me how to update the evil-unimpaired function so it works properly. My emacs-fu is pretty much nonexistent, unfortunately

2
  • I don't think the question is very clear at this point. Please edit it to clarify what you would like to achieve. – TerryTsao May 6 at 5:37
  • @TerryTsao updated – evakuator May 6 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.