Sublime text 3 misinterpreting indentation when code is pasted

You don't tell us how you are pasting the code so I am assuming you are doing a simple paste rather than the Sublime Text way with Shift :

Sublime’s Paste and Indent command fixes this by automatically adjusting the indentation of your pasted code to match the surrounding lines.

This command is bound to Ctrl+Shift+V on Windows and Linux or Shift+Cmd+V on Mac. Give it a try—it’s magical.


I know this is too late to answer but alternatively for @jwpfox answer, you can switch it in keybindings like so:

{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+v"], "command": "paste_and_indent" },

You can switch these 2 keybindings if you want to use the paste and indent by default.