Search code examples
intellij-ideaintellij-14

Intellij IDEA - Copy code without unnecessary indentation?


I want to write and test my code before I post an answer on a Stack Exchange. If I copy the working code over to Stack Exchange, it is indentated with too many spaces before each line.

How can I transfer the code over without the unneeded indentation?


Solution

  • Try Ctrl + Shift + Alt + [mouse/touchpad selection]

    it will select code in "column" mode. Means, no unneeded spaces from the left of right side, will copy the rectangular selection.