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?
相关问题
- Symbol's function definition is void: declare-
- React Native Inline style for multiple Text in sin
- How can I set the SVN password with Emacs 23.1 bui
- Emacs shell: save commit message
- How to change the first two uppercase characters o
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- ess-rdired: I get this error “no ESS process is as
- Emacs/xterm color annoyance on Linux
- Pipe less to Emacs
- Rendering plain text through PHP
- Capturing the output of “diff” with org-babel
- Python thinks a 3000-line text file is one line lo
- PowerShell Pass Named parameters to ArgumentList
In addition to the previous answers you can also define your own function to duplicate a line. For example, putting the following in your .emacs file will make C-d duplicate the current line.
Nathan's addition to your .emacs file is the way to go but it could be simplified slightly by replacing
with
yielding
This functionality should match up with JetBrains' implementation in terms of duplicating both by line or region, and then leaving the point and/ or active region as expected:
Just a wrapper to around the interactive form:
Which calls this,
Or this
And then I have this bound to meta+shift+d
install duplicate-thing from melpa
and add this keybinding:
(global-set-key (kbd "M-c") 'duplicate-thing)
With prefix arguments, and what is (I hope) intuitive behaviour:
The cursor will remain on the last line. Alternatively, you might want to specify a prefix to duplicate the next few lines at once:
I find myself using both often, using a wrapper function to switch the behavior of the prefix argument.
And a keybinding:
(global-set-key (kbd "C-S-d") 'duplicate-line)
@[Kevin Conner]: Pretty close, so far as I know. The only other thing to consider is turning on
kill-whole-line
to include the newline in the C-k.