I saw this same question for VIM and it has been something that I myself wanted to know how to do for Emacs. In ReSharper I use CTRL-D for this action. What is the least num
I use
C-a C-SPACE C-n M-w C-y
which breaks down to
C-a: move cursor to start of lineC-SPACE: begin a selection ("set mark")C-n: move cursor to next lineM-w: copy regionC-y: paste ("yank")The aforementioned
C-a C-k C-k C-y C-y
amounts to the same thing (TMTOWTDI)
C-a: move cursor to start of lineC-k: cut ("kill") the lineC-k: cut the newlineC-y: paste ("yank") (we're back at square one)C-y: paste again (now we've got two copies of the line)These are both embarrassingly verbose compared to C-d in your editor, but in Emacs there's always a customization. C-d is bound to delete-char by default, so how about C-c C-d? Just add the following to your .emacs:
(global-set-key "\C-c\C-d" "\C-a\C- \C-n\M-w\C-y")
(@Nathan's elisp version is probably preferable, because it won't break if any of the key bindings are changed.)
Beware: some Emacs modes may reclaim C-c C-d to do something else.