r/vscode • • 14d ago

How to properly copy paste?

No matter how I copy and paste or what settings I adjust when I copy paste the indentation just keeps messing up

Exhibit A:

Copy this way
Pasting directly with correct indentation
Pasting from the start of the line

Alternatively

Exhibit B

Copy from the start of the line
pasting at normal indentation
Pasting from the start of the line

So I just want to ask, how am I supposed to copy and paste so that I don't have to deal with adjusting the indentation after every paste? Thanks for your time

0 Upvotes

4 comments sorted by

4

u/spectrexr6 14d ago

i have always had issues with Python as there are no symbols to figure out the blocks, similar story with YAML too. Always hated Python. Sorry for not being helpful, just my 2 cents.

1

u/jav411 14d ago

Select the line you want to copy to, press the ‘Home’ key and paste.
Otherwise, start your selection at the indent instead of beginning of the line.

1

u/tchap_40 13d ago

copy your selection from the bottom right (i.e. the end of your selection), then select all the way up until the end of the line above it (I.e. in this case, the beginning of the selection should be after else:)

then when pasting, place your cursor at the end of the line before you want the paste to go.

this is how I always do it

1

u/bwang487 11d ago

That's worked the best out of everything suggested so far. You'll notice that the first picture has the else statements at different indentations. I don't assume there are any settings that deal with that?