Love Sublime text, though I have come across an issue which seems to be an inconsistent issue when copying code. I used tab
for indentation, and when I need to copy over code, it seems to attempt to interpret the tabs as spaces, but results in sending the indentation wonky.
I know you can go into settings, so I did, and change the values for properties such as tab_size
, translate_tabs_to_spaces
, but nothing seems to prevent it from happening. Instead of being 4 spaces for indentation, the lines are only one space, and when I hit tab
it moves it one space.
Question
How do I force Sublime to only use tab
for indentation which is currently set to 4
spaces everytime I create a new document?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With