ITeye博客

emacs duplicate line

jedy · 2006-02-19 07:44 · Markdown

找了半天都没有找到复制一行的函数,没办法,只有自己写一个了。
前些日子看的Lisp又都忘记了,写了这么个简单的东西都要看半天
书。


(defun wh-duplicate-line ()
"Duplicate current line"
(interactive)
(let (start end)
  (save-excursion
 (move-beginning-of-line 1)
 (setq start (point))
 (move-end-of-line 1)
 (setq end (point))
 (newline)
 (insert-buffer-substring (current-buffer) start end)
 )
  )
(next-line 1)
)

(global-set-key (kbd "C-<return>") 'wh-duplicate-line)

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。