Can Intellij IDEA cut/copy/paste one line just like VisualStudio or sublime text?

In VisualStudio or sublime text, you can paste one whole line(iucluding return character) at  wherever the cursor is.

How can I do the same in Intellij IDEA?

6 comments

Triple click (whole line selection) and then Ctrl + (X/C/V) does it.
Also, Ctrl+D with no selection duplicates current line
Ctrl+C/X with no selection copies/cuts current the line

0

No need in triple click.
Ctrl+X / Ctrl+C without any selection behaves as if the whole line is selected.

0

When you hit Ctrl+V, you just paste the line with a return char.

Like this:
          var foo = 1;\r\n

What I want is:
\r\n
          var foo = 1;\r\n

0

When you hit Ctrl+V, you just paste the line with a return char.

Like this:
          var foo = 1;\r\n

What I want is:
\r\n
          var foo = 1;\r\n

0

While I do not believe there is a built in way to do that, you can easily record a simple macro (Edit > Macros > Start macro Recording) of an [Enter] , [Paste] sequence. Give the macro a name, and then map it to a shortcut via the keymap: File > Settings > [IDE Settings] >  Keymap > Macros > ${yourMacro} If desired, you could remap Ctrl+V to it.

0

Yes, Marco works. But the Ctrl+V is conflicted with default paste, I use Ctrl+shift+D instead. Thanks~~

0

Please sign in to leave a comment.