[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A single line copy
From: |
Miles Bader |
Subject: |
Re: A single line copy |
Date: |
27 Mar 2001 15:36:29 +0900 |
Jan Hrabe <hrabe (@) balrog.aecom.yu.edu> writes:
> I wonder if someone could advise the best way to copy a single line to
> a buffer (like yy in vi).
Try putting the following in your .emacs file:
(defun copy-line (n)
"Copy N lines at point to the kill-ring."
(interactive "p")
(kill-ring-save (line-beginning-position) (line-beginning-position (1+ n))))
(global-set-key "\C-ck" 'copy-line)
This makes `C-c k' copy the current line to the kill-ring, or if invoked
with a prefix argument, that many lines (if the prefix argument is
negative, then lines _before_ the current line are copied).
Note that this includes the final newline; if you'd rather not have
that, change `(line-beginning-position (1+ n))' to `(line-end-position n)'.
-Miles
--
Love is a snowmobile racing across the tundra. Suddenly it flips over,
pinning you underneath. At night the ice weasels come. --Nietzsche
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: A single line copy,
Miles Bader <=