When selecting a word in RStudio (on macOS) by double-clicking it, the cursor position depends on the clicking position, e.g. for aaabbb:
double-clicking on one of the as results in selecting aaabbb and having the cursor set in front of aaabbb.
double-clicking on one of the bs results in selecting aaabbb and having the cursor set behind of aaabbb.
This leads to different behavior when using key sequences afterwards to expand the selection.
Is it possible to disable this "feature" and to always have the cursor set behind the selection?
A even better solution would be to completely "remove" the cursor. By this I mean that the normal macOS behavior after double-clicking on aaabbb in this is aaabbb a sentence and then:
pressing Shift+← would be, that the selection is expanded to aaabbb
pressing Shift+→ would be, that the selection is expanded to aaabbb
Clarification:
The current behavior of RStudio is as follows: Given this is aaabbb a sentence and
double-clicking on the left half (aaa) and pressing Shift+← RStudio selects aaabbb
but double-clicking on the right half (bbb) and pressing Shift+← RStudio selects aaabb (unselecting the last b)
(analogously for Shift+→)
Related
I've been looking all over, but can't find the following shortcut:
Does MSVC 2022 have a shortcut, either builtin or via an extensions, to delete the word under the cursor?
I know that Ctrl+Del deletes from the cursor to the end of the word. Ctrl+Backspace deletes from the cursor to the beginning of the word. Ctrl+w selects the current word. But, I can't find deleting the word under the cursor in just one shortcut. I usually do Ctrl+w, followed by backspace.
Another shortcut I wish it had, but which I'm pretty sure it doesn't, is jumping to the vertical and/or horizontal middle of the text window. This is to complement Ctrl+PageUp/PageDown, which jump to the top and bottom of the text window.
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.
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.
Maybe this is wishful thinking, but is there a way to quickly copy, or even just select, multiple lines quickly in Visual Studio? Similar to a multiple yank in vim.
I'm aware of the copying a single line, by just pressing Ctrl+C with nothing selected, but can't find any way of doing this for n lines.
If there's nothing that comes with it, is there any way to write a macro to achieve this?
To select multiple lines using the keyboard (starting from the current line, selecting downwards):
Press HOME (to move the cursor to the first character of the current
line)
If the cursor is NOT all the way to the left (i.e. Col 1) press HOME
again
While holding the SHIFT key press the DOWN ARROW (each subsequent
DOWN ARROW will select an additional line)
Alternatively the UP ARROW can be used to select lines from the starting line up.
Additional info: Combinations of SHIFT, CTRL and all the ARROWS can be used for various cursor moving and character selection, examples:
CTRL + Left (move the cursor to the start of the current word)
CTRL + Right (move the cursor to the start of the next word)
SHIFT + LEFT (select the previous character)
CTRL + SHIFT + RIGHT (select all characters to the right of the cursor, in the current word)
When editing code in VS, I typically use Ctrl+G to move to the line number that I want. It would be really nice if there's another keyboard shortcut that would allow me to move to the word that I want on that same line as well regardless of the cursor's position.
Example:
Say, I just moved to this line:
quint32 beamNum; // Number of beams
and say I want to move to the word "Number"
typically I have to press Ctrl+→ a few times (in this case exactly 4) to get to the word that I want. Imho, this is not fast enough.
I did try using Ctrl+F but it doesnt work for all cases because sometimes I want to search backward and if "Search Up" is not checked, it then becomes too slow.
Just wondering if anyone knows of such shortcut, if one exists.
So, Ctrl+G will take you to the first column of the line. Then, you can press Ctrl+I (not an L) to begin an incremental search. Now, start typing the word that you are looking for (case sensitive) and the IDE will move to the first match of what you're typing. Hit Enter to end the incremental search.