3 ms·
Of course there is a way to duplicate a line in Emacs by default. Like in vi, you compose simple commands. Let's see: ; Duplicates the current line S-C-b
by jlokier 6y ago
Of course there is a way to duplicate a line in Emacs by default. Like in vi, you compose simple commands.
Let's see:
; Duplicates the current line
S-C-backspace C-[y y]
; Duplicates the current line
C-[a k k y y]
; Duplicates the current line
C-[a SPC n w y y]
; Duplicates the current line
C-[a SPC n] ESC w C-y
Repeat duplicating until it looks like enough:
; Duplicate again until happy
C-[y y y...]
; Duplicate again until happy
C-x z z z...
Duplicate 3 lines instead of 1:
; Duplicate this line and the next two
C-[a u] 3 C-[k y y]
Duplicate 10 times:
; Duplicate the current line 10 times
C-[a k k] C-x ( C-y C-x ) C-u 10 C-x e
; Duplicate the current line 10 times
C-[a SPC n w] C-x ( C-y C-x ) C-u 10 C-x e
; Duplicate the current line 10 times
S-C-backspace C-x ( C-y C-x ) C-u 10 C-x e
Remove duplicate lines instead:
; Select region, then
M-x delete-duplicate-lines
- dotancohen 6y agoThank you very much!