Emacs extension that allows a user to yank or copy a specific line by line number.
To install simply add to your load path and include as below:
(add-to-list 'load-path "/path/to/yank-line") (require 'yank-line)
Provides two convenience methods yl/copy-line and yl/yank-line that take a numeric argument which can be provided by C-u and copies the text from the given line skipping any initial indentation. If no numeric argument is provided then the current line is yanked or copied.
To copy the contents of line 20 and paste it at the current position you would do:
C-2-0 M-x yl/yank-line
To merely copy the contents from line 20 into the kill ring:
C-2-0 M-x yl/copy-line
You can also use these slightly more long-winded alternatives:
C-u 20 M-x yl/yank-line C-u 20 M-x yl/copy-line
This is especially useful in a situation where you can see the line you would like to duplicate but want something faster than navigating to the line and copying.