Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPstorm code paste indent

I have following problem:

When I hit new line in PHPstorm (this line has indent) and paste some code, this code appear at the beginning of line. It's really annoying to indent every paste code.

Is there some way how to configure this?

like image 975
general666 Avatar asked Oct 03 '14 12:10

general666


People also ask

How do I indent in PhpStorm?

If you need to adjust indentation settings, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.

How do I align text in Webstorm?

Go to PHP Storm > Preferences > Editor > Code Style > PHP > Wrapping and Braces > Assignment Statement > Align consecutive assignments . To activate it go to Code > Reformat Code or press Cmd+Opt+L .


2 Answers

Settings/Preferences | Editor | General | Smart Keys -> Reformat on paste

enter image description here

You can also use Code | Auto-Indent Lines (Ctrl + Alt + I using Windows keymap) on selected lines to re-indent them without applying the actual code formatting rules (lines breaks, force braces etc.)

P.S. Edit | Paste | Paste as Plain Text (Ctrl + Alt + Shift + V here on Windows keymap) can be used to insert the text as is without any help from such smart helpers.

like image 111
LazyOne Avatar answered Sep 22 '22 05:09

LazyOne


This setting moved to a slightly different location in the menu structure in Webstorm. Go to

Settings | Editor | General | Smart Keys | Reformat on paste

and then select None.

Smart Keys is now a submenu on the General menu, which is different from another answer to this question.

like image 30
steampowered Avatar answered Sep 22 '22 05:09

steampowered