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

Answered

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?

3
10 comments
Avatar
Permanently deleted user

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

3

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

2

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

1

Alexis & Qidong: You may want to look at the "Missing in Actions" plugin -- https://plugins.jetbrains.com/plugin/257-missing-in-actions -- One of its listed features is:
"Enable Auto Line Selections and select full lines without loosing time or column position by moving the caret to the start of line when selecting or pasting. Choose whether you want to paste full line selections: above or below the current line regardless of the caret’s column."

I'm not familiar with Sublime nor the particular feature mentioned here. But the feature I mentioned from the MIA plugin sounds similar. If not, I suggest opening a feature request with that plugin for the feature you are looking for. The author of that plugin tends to be pretty responsive to feature requests (based on my experience with another plugin of his). And it sounds like he may already have the basics in place to easily add what you are looking for.

1

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

I have been searching for hours and hours for a way to get the pasting behave like qidong wang mentioned, I find it incredible that there is no option to handle that at this point...

0

Thank you much Mark! Missing in action did solve it:

0

Unfortunately, this plugin no longer functions correctly at least on the latest MacBook Pro.  I'm still looking for a clean solution after losing my mind most of the day trying to figure it out.

0

Please sign in to leave a comment.