Insert full lines with Emacs + Evil

In Vim, I often move lines by deleting them (either using ddor in visual line mode), moving the cursor to a new position, then pto insert them:

first
second
third

And if my cursor is on the second line, I can use ddpto move it down:

first
third
second

But with Emacs + Evil mode, line wrapping does not work as expected: if, for example, my cursor is at I in the third, when I click p, I get:

first
thisecondrd

How can I get Emacs + Evil mode to insert new lines when placing whole pulled lines?

+4
source share
3 answers

C-a, (^ , ), , . , , , yank, , . ( , ?)

, , transpose-lines (Cx Ct Emacs - - xtl - https://github.com/syl20bnr/spacemacs/blob/master/my-keybindings.el).

+1

, , , C-a C-k C-k C-a C-space C-n C-w ( , C-k, C-n, C-n ), , C-y yank.

, Emacs , . vi, C-f , ; backspace ; . , . , Emacs , , , vi - , , - , , , , .

+1

, , ( , " Emacs + Evil mode " ), move-text.

, (move-text-up move-text-down) . ; - , .

, move-line-down ( second):

first line
second| line
third line

first line
third line
second| line

, ( ) n , .

M-up M-down ,

(define-key evil-normal-state-map "mu" 'move-line-up)
(define-key evil-normal-state-map "md" 'move-line-down)

move-text package-install MELPA.

0

Source: https://habr.com/ru/post/1537975/


All Articles