DEV Community

Discussion on: 💻The guide to Visual Studio Code shortcuts, higher productivity and 30 of my favourite shortcuts you need to learn

Collapse
 
ianyates profile image
Ian Yates

Rectangular selection...
This one always gets me in VS code. In VS, SQL management studio, etc, the key is Alt Shit & arrows.
But in VS Code, as you explain, that duplicates the line.
How do you do it in VS Code? Super useful when you need to enter the same text into multiple lines at once, possibly with an overwrite.

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

I don't fully understand.

Can you explain a little bit more what you need?

Collapse
 
lhartvik profile image
Lars Hartvigsen • Edited

ctrl+alt and up/down arrow lets you edit several lines at once

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Oh, he means multi editings!

Yeah I left that one out because it this is one little harder to understand there will be an extra post about efficient editing :)

Thread Thread
 
lhartvik profile image
Lars Hartvigsen

That's great, looking forward to it!

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

Thank you :)

Collapse
 
edoardoc profile image
Edoardo Ceccarelli

shift+alt + select with mouse will give you a rectangular selection / column selection... also, middle mouse click does it.
Unfortunately works for mac only (at least for me), on Linux there seem to be some conflict with window movements, I have not tried it on Windows and I'd like to know.

code.visualstudio.com/updates/v1_2...

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski • Edited

Ahh okay!

Yeah, that works on windows for me but I don't use that.

Can not think of any situation where i need that 🤔

Thread Thread
 
edoardoc profile image
Edoardo Ceccarelli

yes, it isn't really an everyday thing but it can be useful when editing SQL or old languages where column alignment is everything. To tell you the truth I started using that on the native os x text editor, you just press option and start dragging around, the cursor becomes a cross and all makes a bit more sense :)

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

Okay, usually when I work with SQL it is not directly SQL but some layer over SQL ;)

So with what old languages are you still working with?

Thread Thread
 
edoardoc profile image
Edoardo Ceccarelli • Edited

yes, that is what one should do (in fact lately I am dropping SQL all together), but the box selection I used it a lot when I was creating ui elements in objective c with this tool, ASCIImage that transforms a string like this:

+ (UIImage *)chevronImageWithColor:(UIColor *)color
{
NSArray *asciiRep =
@[
@"· · · · · · · · · · · ·",
@"· · · 1 2 · · · · · · ·",
@"· · · A # # · · · · · ·",
@"· · · · # # # · · · · ·",
@"· · · · · # # # · · · ·",
@"· · · · · · 9 # 3 · · ·",
@"· · · · · · 8 # 4 · · ·",
@"· · · · · # # # · · · ·",
@"· · · · # # # · · · · ·",
@"· · · 7 # # · · · · · ·",
@"· · · 6 5 · · · · · · ·",
@"· · · · · · · · · · · ·",
];
return [self imageWithASCIIRepresentation:asciiRep
                                    color:[UIColor blackColor]
                          shouldAntialias:NO];
}

into these hi res images, on the fly:
chevron rendered
it really helped a lot although you end up creating the weirdest copy and paste combinations - hence the box selection :)

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

Crazy stuff!