How do I duplicate a whole line in Vim in a similiar way to CTRL+D in IntelliJ IDEA/Resharper or Ctrl Alt Arrow in Eclipse?
yy
will yank the current line without deleting it
dd
will delete the current line
p
will 'put' a line grabbed by either of the previous methods
1 gotcha: when you use "p" to put the line, it puts it after the line your cursor is on, so if you want to add the line after the line you're yanking, don't move the cursor down a line before putting the new line.
yy (copy the line)
or
dd (delete the line)
then
p (paste the copied or deleted text **after** the current line)
or
P (paste the copied or deleted text **before** the current line)
yyp - remember it with "yippee!"
Multiple lines with a number in between:
y7yp
If you want another way :-)
"ayy this will store the line in buffer a
"ap this will put the contents of buffer a at the cursor.
there are many variations on this.
"a5yy this will store the 5 lines in buffer a
see http://www.vim.org/htmldoc/help.html for more fun
You can also try <C-x><C-l> which will repeat the last line from insert mode and brings you a completion window with all of the lines. It works almost like <C-p>
Another option would be to go with:
nmap <C-d> mzyyp`z
gives you the advantage of preserving the cursor position.