Created
June 18, 2014 11:17
-
-
Save dsjt/58318935288e68794de7 to your computer and use it in GitHub Desktop.
duplicate-line for emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun duplicate-line(arg) | |
(interactive "nTimes:") | |
(or (and (numberp arg) (> arg 0)) (setq arg 1)) | |
(beginning-of-line) | |
(kill-whole-line) | |
(yank) | |
(multi-yank (- arg 1))) | |
(defun multi-yank(arg) | |
"yank [arg] times." | |
(interactive "p") | |
(or (and (numberp arg) (> arg 0)) (setq arg 1)) | |
(if (= arg 1) | |
(yank) | |
(progn (yank) | |
(recur-multi-yank (- arg 1)))) | |
(defun recur-multi-yank(arg) | |
(if(= arg 1) | |
(yank) | |
(progn (yank) | |
(recur-multi-yank (- arg 1)))))) | |
(global-set-key (kbd "C-S-y") 'duplicate-line) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment