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