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 number of commands to perform this in Emacs?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I use
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
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-din your editor, but in Emacs there’s always a customization.C-dis bound todelete-charby default, so how aboutC-c C-d? Just add the following to your.emacs:(@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-dto do something else.