There are already many questions about VS Code's block selection and multi-cursor selection, and I'm not asking how to use it, but rather, how to make it behave in the standard way on a Mac (without the shift ⇧ key pressed).
The way it currently behaves is this: your current cursor location defines one corner of the block selection, and when you press ⇧⌥ and click somewhere else, you define the opposite corner of the block. You can drag as you're clicking, but dragging really only changes the definition of that opposite corner. Your (text) cursor's position always defines one of the block's corners.
Considering that the VS Code default keybinding is ⇧⌥, the behavior is proper for having the shift ⇧ key pressed. But I'm trying to find a way to get the normal behavior that you'd expect on a Mac when the shift ⇧ key is not pressed.
In normal Mac behavior (without shift), the entire block is defined by:
where you first click, before you start dragging, and
where you release, after dragging.
This behavior is exactly the same as for plain-vanilla text selection, except that you get a block, instead of a line-oriented selection.
I would like to find a way to have VS Code allow me to define the block selection solely based on where I click and drag, and not based on the current text cursor location.
How can I do this?
Note that you don't have to drag the mouse. You can single click (with no modifier keys) in one corner, press and hold Shift and Option, and click in the opposite corner, then release the Shift and Option keys. So, your attempt to start the selection is actually extending it (relative to the previous selection).
What's working for me in 1.53.1 (January 2021 release) is to click and hold the mouse button (with no keys pressed; this starts a normal, non-column selection), then press and hold Shift and Option, then continue dragging the mouse. I find this method cumbersome and prefer selecting opposite corners as above.
I don't see an obvious way to change to Option-only to start a column selection.
Related
In Visual Studio, when I position my cursor to the right of the semi-colon of the following C#:
var alpha;
When I press the left cursor key, nothing happens (call me old-fashioned but I want the cursor to move to the left). Instead, I notice VS shows in the status bar
(Left Arrow) was pressed. Waiting for second key of chord...
How can I setup VS so that Left Arrow is not the start of a chord in the editor?
I can go to Keyboard options but how do I find chords that start with Left Arrow?
I couldn't find a way to do this with VS. However, I found Resharper's Shorts Live View feature (press the left Ctrl key three times in text editor) which displays current shortcuts to be valuable in reporting what actual shortcut had been assigned an are currently active.
It seems I must have pressed Left arrow when assigning a keyboard, so with this tool I could see the name of the command assigned and remove it from Tool | Options.
If I want to delete few lines of text in most of text editors, not touching some words on the bottom line and the whole upper line, I put cursor on the bottom row leaving all unnecessary words to the left of the cursor. Then I select few lines vertically by holding Shift + ↑. I stop on upper row and get some selection: part below + right part of the upper row:
In this example I want to get rid of if word and an empty space between the function header and the code, not touching the function header (even hough let will stick to the opening bracket {).
Normally (not in Xcode) I would still hold Shift and will press cmd + ➝ to deselect the right (selected) part or the top row.
Result will be like this:
I can simply press Delete and job is done.
However, in Xcode such shortcut usage makes bottom row fully selected (till the right) and not changes upper row selection:
Same thing happens if you select from top to bottom and you need to remove extra selection from the bottom line.
I tried to rebind shortcuts in Preferences but didn't find a solution.
This example is very particular and maybe not the best, however I face such selection problems only in Xcode and have to use mouse which is not handy.
This is a rather old question, but what you want is fairly simple to achieve. If your cursor is between the if and the let, you would only need to press option-shift-left arrow twice. The first time, it would select the if and the leading tabs, and the second would select the empty line.
I am unable to perform multi-file text search and replace (in Visual Studio).
In the past, when I opened the "Replace in Files" dialog, there were 4 buttons in the lower right. One of the bottom two buttons allowed me to "Replace All".
The two lower buttons (including "Replace All") are no longer present.
I believe this occurred after I changed some Windows settings so that I could use menus without the Magnifier.
It is not just a matter of the buttons being off-screen because the window is too large (although it is too large - they would be off-screen, if they were present).
I can drag the window and see the bottom, even though the top is then off-screen (I use AltWindowDrag, allowing me to hold the ALT key, and drag by any part of the window, not just the title bar).
The two lower buttons are not present. I'm unable to resize the window - when I try, nothing happens, or the window repositions so that I can see the title bar, but can no longer see the bottom.
The two buttons that are still present (Find Next and Replace) don't have keyboard shortcuts, so I presume that Replace All doesn't either. Nor can I select either of those two buttons using Tab, so probably can't select an "invisible" "Replace All" button that way.
Any help appreciated.
You can use Find and Replace by pressing Ctrl+H and to Replace All just use Alt+A.
when selecting large swaths of text from webpage I have to keep left mouse button pressed while searching for the selection's end. It would be nice if the browser would "remember" selection's start point and let me search for the ending point, e.g. by dragging the scrollbar downwards, without pressing the mouse button.
Does a plugin or other implementation of this sort already exist?
The answer to this is OS/Windowing system specific. In most/all systems there is a normal way to have the system perform what you are desiring. An add-on for Firefox is not required.
Windows:
If you click (button down and up, not button down and hold) at the start, or the end of the selection you desire then move the mouse to the other end of the desired selection (scrolling the page as needed to get the the other end) you can then hold the shift key down and click again. This will select the entire region from the first point you clicked to the second point you clicked while holding the shift key. You can adjust the selection by continuing to hold the shift key while doing any of: clicking on a different location, performing a click-drag movement, or using the keyboard cursor keys. This adjustment does not change the point at which you first clicked, just the second, end point.
It is also possible to use the control key to select individual items. This is possible in combination with clicks, double-clicks, and triple-clicks. An example would be to move your mouse around in this paragraph holding the ctrl key down while double-clicking on various words. Your selection will include just the words on which you double-clicked. In some instances, when using only a single ctrl-click to select from a discrete list (e.g. a Windows Explorer folder display), a second ctrl-click on the same item will de-select it. You can also combine the use of ctrl-click and shift-click to create more complex selections with the beginning of the shift-click selection starting at the most recent ctrl-click location.
The Mouse and Pointers page in the Windows Dev Center provides some fairly technical descriptions as guidelines for Windows developers.
Linux (using GNOME):
The interactions are similar to What was described for Windows, but a bit different. Section 10.1.2. Selecting Objects of the GNOME Human Interface Guidelines 2.2.3 provides a good description.
Apple/OSX:
The Macintosh Human Interface Guidelines describes how selections can be made on Apple machines.
I have a long line that I want to select a section in the middle. In Visual Studio, it would scroll all the way to the end of the line, passing where I want the selection to end, when I move pass the text area and move all the way back when I try to move back a little. Is there a way to slow down the Visual Studio scrolling adjustment?
If you are talking about selecting text using the mouse you can get fine grained control by combining the the mouse and keyboard. This should work in any application that allows text selection, not just Visual Studio.
First click the location where you want to begin selecting text.
Next scroll to the location where you want to end selecting text and hold down Shift on the keyboard while clicking with the mouse. The block of text between the first click and the shift+click will be selected without having to worry about the selection jumping around due to scrolling.
As for actually slowing down the scrolling; I know of no way to do that. Hopefully my tip should give you an alternate way to do what you actually want.