Duplicate a line in emacs

When coding you often have to duplicate a line. This is a little script for your .emacs file to do this:

;; Duplicate it
(defun duplicate()
"Duplicate it."
(interactive)
(let (
(beg (line-beginning-position))
(end (line-end-position)))
(copy-region-as-kill beg end)
(beginning-of-line)
(forward-line 1)
(yank)
(newline)
(forward-line -1)))

3 comments:

dublpaws said...

thanks, very useful for proofs

gfh said...

we offer wow power leveling and wow gold wow gold

Anonymous said...

what is key-binding for this duplication?