How can I block select multiple lines of code in VS 2012? - visual-studio

My question today is, when selecting multiple lines of code and not completely selecting the full line for all the lines selected, how can I (or is there any keyboard shortcut for) block select all the lines that I have already selected, so that I have not just some lines fully selected and some not fully selected, but all the lines are fully selected from the home of the top line selected, to the end of the last line selected?
Note: The bold text in the segment above is what I am mainly trying to ask.
Thanks to anybody that is able to provide me with any helpful information!

From your question it looks like you want to select a block and not the complete line.
Hold the alt key and use the mouse to select your block.

You can use Alt + Shift + Arrow keys..
Its called Box Selection and was introduced in VS2010.
learn more about it here

Related

Visual studio is it possible to select line then find and replace text in selected area? [duplicate]

This question already has answers here:
Find and replace in Visual Studio code in a selection
(11 answers)
Closed 1 year ago.
Need to know many times I need to replace code in selected lines and I am doing one by one because I dont need to change it on whole file or project. Is it possible to find and replace in selected area ?
Example i have these 8 line code i need to replace _monday only on the last fourth (Mean which i have selected)
Yes, but it looks like you need to do it in a certain order, otherwise it will un-highlight your selection.
Open "Find" with Ctrl + F.
Highlight whatever text you want to replace some text in.
Use Alt + L or click the three lines icon in the Find control to toggle the "Find in Selection" option.
Replace the text as your normally would, and it should now only replace any text within the highlighted text.
Example for reference:

How do I turn off "column box select" in visual studio code?

I seem to be unable to turn off box/column select. In other words, if I try to select across multiple lines, I only get a box select, as opposed to the usual behavior where entire lines are selected as I add lines.
I am using version 1.48.2 on a mac.
I must have pressed option+shift or some other such code inadvertently and now I can only select boxes. I have looked at my keyboard shortcuts but I don't know what to look for...
Unfortunately searching for solutions via google or SE only produces results for how to turn it on, not off! I don't know what the opposite mode is. "line select" seems to be just to select the current line, not for entire lines across multiline selections.
example of current behavior. I want the entire line "spaceship..." to be selected.
Just found the answer myself looking for something else. There is a "Text Editor" setting called "Editor: Column Selection" that controls this. The default is off, but I must have turned it on somehow without realizing it. Thanks to anyone who may have taken time to read this....
Cmd+8 is the shortcut to toggle the setting

Visual Studio column selection - Select by word, not square

This seems like something I would have found hundreds of topics on. Yet I didn't find a single one. I wonder if no one cares or if I just overlooked something obvious.
In Visual Studio when you select a column and want to select the word your cursor is at in each line, when you do CtrlShift+(ARROW KEY), then it doesn't select by word as it SHOULD, but instead it selects a square.
BAD BEHAVIOUR (which VS has):
GOOD BEHAVIOUR (which would be expected, and is in every other IDE):
The Visual Studio ALT select is rendered useless in half the cases, actually in every case where you don't have the "coordinates" precisely the same on every line.
EDIT
I seem to have to explain why the VS behavior is bad, people apparently consider it ok. So the problem is that when you column select in VS, and you have it exactly like in the example, or even without tabs, you'd copy some =, though they won't be everywhere.
If you select a column like VS Code or JetBrains has it, you'll just copy WHAT IS NEEDED and that OBVIOUSLY being just the words in the column.
I have a solution for you, but you may not like it. It's using the new Multi-Caret Support in Visual Studio 2017.
Here is my example code where I want to copy only the property names (sorry for lack of inline images):
Multi-Caret Code Example
Using Ctrl + Alt + Click to click and add a caret to the end of each word. (If you screw up and click somewhere you didn't mean, like I do many times, then reclick to remove that caret and click on the correct spot.)
Multi-Caret End of Line
Now hold Ctrl + Shift and hit the ← Left Arrow. This will select to the beginning of the current word on each line.
Multi-Caret Word Selected
Copy/paste as you wish

Visual Studio\Python -How to move multiple code lines to right

Sorry for the silly question, but i'm trying to move my code right but doing it line by line.
Lets say my code is
if x==0:
print a
else:
if x==3:
and lets say i want to add new "if" in the begining of the code i need to take all my code right
so the new code will look like:
if y==3:
print y
else:
if x==0:
print a
else:
if x==3:
as for today i'm pressing "space" several time on each line to set it in the right place
I know that "ALT" and arrow take it up\down but coudnt fine the left right if there is something like that
thanks
Either move it line-by-line with TAB, or select several lines and use TAB. You can move them in the other direction with Shift+TAB. As already suggested you can also use Ctrl+K, Ctrl+F to auto-format.
In the visual studio settings you can decide whether the spacing consist of tab symbols or actual blank spaces and the number. Keep this in mind, as some file types don't like one or the other.
you can use Shift+tab to move the whole code 1 tab space

How to Add tab space to multilple line at the same time in any text editor

If you select a text you can add multiple tab spaces to the all lines simultaneously.
For that you must select the n lines of the code and press the key tab. If you want
remove the tab spaces should select the text and press shift+tab.
I was programming in my job and I accidentally discovered this in the IDE eclipse. I test the same process
in the Sublime Text and Geany and it works too.
Y suposse and pressume that works for the most of text editor
I can confirm the answer from kelgwiin for sublime text.
Depending on your platform you could also do the following in sublime text:
Linux: Hold shift and the right mouse button, then move the mouse up or down to make a column selection.
Windows + OS X: Simply hold down the mousewheel and move your mouse up and and down to select the columns.
Hope this helps!
On Geany you can create by using Alt+Shift+Mouse (Windows) or Ctrl-Shift-Mouse (*x) a multiline cursor or an rectange selection, where you can work on many lines at the same time. This is only working for lines 'in row' so you cannot choose line 9 and lines 12-16 and lines 23-44 to be edited at the same time.

Resources