Line selection not working properly on VSCode - visual-studio-code

My line selection is acting very weird on VSCode. It goes in this weird multi-line edit mode. I am unable to select multiple lines fully by dragging my mouse down on lines. Even when I use shift and down arrow it does not select the whole line.
Mouse drag selection not working:
Keyboard Shift + Down Arrow not working:

On Mac the solution was simple go to the menu "Selection" and deselect the option "Column Selection Mode".
Now it works as expected.

Two things I use:
I select full lines by clicking and dragging in the 'numbers' columns
For multi-line to work I use the menu option -> Selection -> Column Select Mode

I had the same issue. Resolved it as below.
Go to Selection menu in vs code menu bar.
Untick on Column Selection Mode option.

go to file, preference, settings and search for Editor:Column Selection and desable. this solve my problem

There are two options:
If you wish to perform the desired selection without changing the settings, then hit the ALT key and drag your mouse
Or, just Go to Selection menu in VS code menu and untick the Column Selection Mode option.

Related

How to hide the thing on the right-hand side for better screen ratio? [duplicate]

This beauty appeared after a recent update, and it is very distracting to me.
I searched through the menus, but didn't find any setting to remove it. Is there any way to banish it from the editor?
This is called the minimap, and, as stated in that link,
If you would like to disable minimap, you can set "editor.minimap.enabled": false in your user or workspace settings.
Once you save the settings file, the minimap will be gone.
You can also toggle the minimap from the Command Palette. You can go to 'View' and select Command Palette or just Ctrl+Shift+P and type in the word 'minimap', you will instantly get the option to toggle the minimap.
Click on "File" -> "Preferences" -> "Settings"
After Settings open, in "search settings" or press "Ctrl+f" type "editor.minimap.enabled" this will take you direct to the settings. On left of it edited option will be available right click to it. And set it to "false"
After wards you can see the right side pane is hide.
Ctrl + Shift + P write Toggle minimap and hit enter and it's gone.
While all the answers here will accomplish what the original question asks, they are showing a dated, manual way of hiding the minimap. Current versions of Code have a "Toggle Minimap" item in the View menu, which will hide the minimap without the need to edit anything manually in User Settings.
That view is called Minimap. To toggle, goto:
Toolbar -> View -> Toggle Minimap
I know of 3 ways to show/hide it.
View -> Show Minimap
Ctrl+Shift+P -> Toggle Minimap
Settings.json -> "editor.minimap.enabled": false
I also made a Youtube tutorial here demonstrating all three ways.
In VS,
Click on View on the top toolbar,
Then you will get a pop up, unselect --- Show minimap
Oowekyala's answer is correct. I am adding a description with image for better understanding. Here is the number from 1 to 5 that describe the steps. Firstly click on File->Preferences->Settings. Then you will get User Setting page. Next, type "editor.minimap.enabled" in the search box(step-4). you will get setting option. On left of it edited option(step-5) will be available right click to it.
Go to Preferences->Settings Under text-editor dropdown go to Minimap and there uncheck the enable of a minimap.
This thing is called minimap
to toggle is on and off
crtl+p
then search for ">minimap"
then just click enter
And if you again want to use it, repeat above step's again
Simply Click F1 a text box will appear search for minimap
and select View:Toggle MiniMap
2022 Update
The latest 2022 version of VS Code (1.73.0) now makes this even more simpler. Simply do the following to remove the minimap:
Right click anywhere on the minimap and toggle the Minimap option.
To reactivate the minimap, right click anywhere on the scroll bar and toggle the Minimap option.
From the View menuitem in Visual Code main menu, click on Toggle Minimap
On Windows.
Visual Code version 1.20.1
On Mac: Code - Preferences - Settings, and in the right panel add the following line:
"editor.minimap.enabled": false
Please care the commas, this file needs them after each but the last line. (It will warn you if a comma is missing.)
Tools -> option ->Text Editor -> All Languages -> Scroll Bars -> Behavior
toggle between the 2 options (use bar mode .. & use Map mode ... ) given that "Show vertical scrollbar " option is checked.
enter image description here

Disable multiple cursors in VSCode

I was playing on my vscode configurations and accidentally change some configuration when I want to select the text on my code lines.
For example, when I want to select some lines in my code immediately appears a lot of cursors instead of selecting the text that I wanted. How can I change this configuration? Because a few days ago the selection in VSCode worked properly.
As you can see on the screenshot below, this happens when I try to select those lines :(
Turn off Column Selection Mode
From the main menu: Selection/Column Selection Mode uncheck
or there should be a Column Selection button on the Status Bar to the right that can be disabled.

VSCode: Disable mouse+ctrl interaction

I often double-click to select followed by ctrl+c to copy. I am finding in vscode that ctrl press with the mouse over a word can perform an action. In some cases it selects the whole line, and in others it jumps to the definition of what is underneath. Is there a way to turn this off?
Note that if you move the mouse cursor off the word then it appears the action is not performed.
You could click on Visual Studio code->Preferences->KeyBoard Shortcuts. Keyboard Shortcuts page opens up. You could change any of the keyboard short cuts, by click on edit icon on the left as shown below
You can change the behavior of these features or disable them altogether by going to Tools > Options > Text Editor.
https://devblogs.microsoft.com/cppblog/productivity-structure-visualizer-ctrl-click-to-go-to-definition/

Visual Studio Code: How to split the editor vertically

In Visual Studio Code, a while ago, when I used menu View → Split Editor, it would split vertically. (One file on the left and one file on the right.)
I updated Visual Studio Code and when when I do menu View → Split Editor, it always splits horizontally. (One file on the top and one file on the bottom.)
How can I split vertically?
Change editor split layout from horizontal to vertical
In 1.20
ALT+SHIFT+0 PC (Windows, Linux)
⌘+⌥+0 Mac
Pre-1.20
ALT+SHIFT+1 PC (Windows, Linux)
⌘+⌥+1 Mac
In 1.25
You can split editor into Grid layout. Check View=>Editor Layout
It is nicely presented in Release notes v1.25: VS Code grid editor layout
In 1.58.2 **
** Someone update this with the lowest version where this became true.
The menu entry with the shortcut given above is View=>Editor Layout=>Flip Layout
The Command Palette entry is labeled "Toggle Vertical/Horizontal Editor Layout"
The settings entry is
{
"key": "alt+cmd+0",
"command": "workbench.action.toggleEditorGroupLayout"
}
If you're looking for a way to change this through the GUI, at least in the current version 1.10.1 if you hover over the OPEN EDITORS group in the EXPLORER pane a button appears that toggles the editor group layout between horizontal and vertical.
To split vertically:
⌘+\ Mac
command: workbench.action.splitEditor
To split orthogonal (ie. horizontally in this case):
⌘+k+⌘+\ Mac
command: workbench.action.splitEditorOrthogonal
Method 1
Method2
View -> Command palette -> type 'split'
Method3
Method4
Tip
Add a Keyboard Shortcut for split Editor
Press CMD + SHIFT + P (MAC) and search for Toggle Editor Group
In version 1.23.1, it is Ctrl+Shift+P and Split Editor
This will divide the screens vertically and you can move through them using Ctrl+K+LeftArrow
By default, editor groups are laid out in vertical columns (e.g. when you split an editor to open it to the side). You can easily arrange editor groups in any layout you like, both vertically and horizontally:
To support flexible layouts, you can create empty editor groups. By default, closing the last editor of an editor group will also close the group itself, but you can change this behavior with the new setting workbench.editor.closeEmptyGroups: false:
There are a predefined set of editor layouts in the new View > Editor Layout menu:
Editors that open to the side (for example by clicking the editor toolbar Split Editor action) will by default open to the right hand side of the active editor. If you prefer to open editors below the active one, configure the new setting workbench.editor.openSideBySideDirection: down.
There are many keyboard commands for adjusting the editor layout with the keyboard alone, but if you prefer to use the mouse, drag and drop is a fast way to split the editor into any direction:
Keyboard shortcuts#
Here are some handy keyboard shortcuts to quickly navigate between editors and editor groups.
If you'd like to modify the default keyboard shortcuts, see Key Bindings for details.
⌥⌘→ go to the right editor.
⌥⌘← go to the left editor.
⌃Tab open the next editor in the editor group MRU list.
⌃⇧Tab open the previous editor in the editor group MRU list.
⌘1 go to the leftmost editor group.
⌘2 go to the center editor group.
⌘3 go to the rightmost editor group.
unassigned go to the previous editor group.
unassigned go to the next editor group.
⌘W close the active editor.
⌘K W close all editors in the editor group.
⌘K ⌘W close all editors.
Simply in windows
ctrl + # (the button 2 in the upper horizontal row of numbers in keyboard)
The key bindings has been changed with version 1.20:
SHIFT+ALT+0 for Linux.
Presumably the same works for Windows also and CMD+OPT+0 for Mac.
Use Move editor into Next Group shortcut:
Mac: ^ + ⌘ + Right/Left arrow
If you want to change shortcut:
Open Command Pallette (macOS keyboard shortcut: ⌘ + Shift + p)
Select Preferences: Open Keyboard Shortcuts
Search View: Move editor into Next Group
To change the editor in Landscape and Vertical mode, follow the steps below.
For example, open two files that you have in your left or right side bar, depending on where you are placed. By default it is always on the left.
Now that you have both windows open, you have to use the key combination for PC (Alt + Shift + 1) for (Windows and Linux Operating Systems) or for MAC (Cmd + Option + 1), as commented here v-andrew.
I just found a simple solution. You can drag an opened file and move towards the four sides of the Editor, it will show a highlighted area that you can drop to. It will split the view automatically, either horizontally, vertically, or even into three rows.
VSCode v1.30.2
Update: you can also drag a file from the Explorer to split the Editor in the same way above.
Right-click on the tab that you want to split it into another screen.
Then choose whether you want to split it (up-down | right-left).
I find this is the quickest way, and You can split it to as many screens as you want.
The best way is to configure the VSCode settings to make the default behavior the way you want:
Split Editor (to a new editor group)
"workbench.editor.openSideBySideDirection": "right" // left/right (default)
"workbench.editor.openSideBySideDirection": "down" // up/down
Split Editor in Group (does not create new editor group)
"workbench.editor.splitInGroupLayout": "horizontal" // left/right (default)
"workbench.editor.splitInGroupLayout": "vertical" // up/down

How to navigate up/down using keyboard home keys in Eclipse's suggestions pop up window?

When Eclipse shows a popup for code completion, how do you change the highlighted option using the keyboard home keys? Currently, if the thing I want is third or fourth on the list of suggestions, I have to use the mouse to select it, or use the arrow keys. Is there a way to use the keyboard home keys/ shortcuts with ctrl/alt to do this?
Arrow keys always work for me. Can you be little more specific as to what perspective, editor, etc?
I get a code completion popup when I press Ctrl + 1 in the Java editor. From then on, I can use the arrow keys to navigate.
I'm assuming you want to select from the code completion menu by X for up and Y for down. Go to Preferences > Keys and bind the commands Line Up and Line Down to X and Y, respectively. Make sure that in the When drop-down you select In Windows.
Note that after the settings are applied, X (Y) also makes the cursor go one line up (down) in the source editor. Personally, I use X = Ctrl+P and Y = Ctrl+N which means I can navigate lines and select entries from the code completion menu without lifting my hands off the keyboard.
Unfortunately, these bindings don't work with other pop-up lists in Eclipse, e.g. quick outline (Ctrl+O) or quick access (Ctrl+3). I'd love to find out how to bind these too.