Currently (since build 138.2490 and later) there is a new option Code Style|General|Detect and use existing file indents for editing. It does what you've been asking for: automatically checks existing file indents and starts using them when you copy and paste a fragment, press Enter, indent/unindent and so on. The option is on by default. You can just try it.