Change default split layout - visual-studio-code

I know I can use the Cmd-Opt-O shortcut key to change the split layout, but I want it to default to horizontal splits. I can't find a setting for this. Does anyone know if this is possible in VS Code?

From 1.25 version there are commands to split editor in 4 directions. Example keybindings.json
{
"key": "ctrl+\\",
"command": "workbench.action.splitEditorDown",
},
workbench.action.splitEditorUp
workbench.action.splitEditorDown
workbench.action.splitEditorLeft
workbench.action.splitEditorRight

Related

VSCode how to know when editor is not split?

Until now, I used cmd+2 to split the editor on Visual Studio Code and then cmd+1 and cmd+2 to move between the split editors. This shortcut stopped working for some reason, and I can't set it on the keyboard shortcut menu either.
I checked with another keyboard, so this is not an hardware issue.
Anyhow, I tried to set new keybindings to split the screen and move between the editors, like this:
[
{
"key": "cmd+shift+]",
"command": "workbench.action.navigateRight",
"when": ""
},
{
"key": "cmd+shift+]",
"command": "workbench.action.splitEditorRight",
"when": ""
},
{
"key": "cmd+shift+[",
"command": "workbench.action.navigateLeft",
},
]
The only problem, I couldn't find what I need to write in the when option.
I want my shortcut to split the editor only if the editor is not split yet, and to move between the editors when it is.
How can I achieve that?
The multipleEditorGroups when clause context returns true when there's more than one editor group open.
You don't need to put a "when" for neither of them. Just checked vscode defaults and they don't have any.

How can I change the key bindings in VS Code to change the tab key to four spaces?

I'm running the latest version of VS Code and Windows 10. I'm learning Python and would like all of my indentations to be spaces. However, I'd like to use the tab key to enter those spaces.
I've tried many different variations in the keybindings.json file with no luck.
[
{
"key": "tab",
"command": "-tab"
},
{
"key": "tab",
"command": "type",
"args": {"text": " "}
}
]
With the above code, I was just trying out many spaces to check the difference. However, when I save this as the json file, it doesn't give expected behavior. It will indent the full amount, but when I backspace I'd expect it to go back one space. Yet, it backs up to where a standard tab would be.. hitting it again returns to the beginning of the line.
Is it possible for the tab key to simply be used as a macro for four spaces?
You don't need to change it in json files. You can search Tab Size in VSCode Settings and change its value to 4. If this does not work, click the Editor: Detect Indentation link and disable it. This should solve the problem.

VSC, how to change "Split Editor" to horizontal?

I want to be able to edit the same file while reading lines way ahead of current line. Given nowadays we do chaining, this vertical is not what I want
What I want is the other way.
It took me heck of time to find out the name "workbench.editor" something who controls it. But VSC version update erased it. It can't be found at setting now. Current VSC 1.38.1.
If you want to rebind the split editor command, try this in your keybindings.json:
{ // unbind the default split keybinding
// probably unnecessary to do this but I suggest it
"key": "ctrl+\\",
"command": "-workbench.action.splitEditor"
}
{ // reset the split command to horizontal split
"key": "ctrl+\\",
"command": "workbench.action.splitEditorDown"
}
It won't have any effect on the action of the split editor icon - it is unclear if that is what you want.
Changing the keybinding will result in Ctrl+\ now splitting horizontally instead of to the right.
As #Jeb50 pointed out in the comment, you can change the split editor icon appearance and functionality by Open Side by Side Direction setting. This is demonstrated below:
Select View > Editor Layout > Split Down.
There are many options.
Example Here!

How to toggle Signature help & intellisense VS Code?

I have VS Code on Win8.1.
I really don't like how the signature box opens up over the surrounding code in the editor. I do like the intellisense box. On the page (link above) it says Ctrl+Shift+Space to manually trigger signature help. But how can I close it? The problem is that it opens up without me triggering it.
I know I can close it by moving the cursor out from the function block. But that is a pain to have to do that all the time. I wish Ctrl+Shift+Space could toggle the box.
I remember when I used Visual Studio. There was a key-short-cut to toggle or to get opacity on the boxes. That was great. Is that possible in VS Code?
It is for JavaScript/React (if that's important)
EDIT:
I found an answer on Reddit that don't give me the good solution Visual Studio has. But it makes the box a bit transparent. But it is always transparent. Here is the solution for the half-way-workaround (cut-and-past from the reddit-post, user: tgreen7):
I found a way to do this in settings. if you go here https://code.visualstudio.com/docs/getstarted/theme-color-reference and search for "editorSuggestWidget.background" that is the setting you are looking to change.
So for example my background was originally the hex color: #21252B
And I changed my settings like so:
"workbench.colorCustomizations": {
"editorSuggestWidget.background": "#21252BAA"
}
and now my suggestion window has opacity. You can adjust the last two digits of the hex number to get your desired transparency (opacity).
escape will close it, and then Ctrl+shift+space to get it back.
If you want a toggle try this with whatever keybinding you want:
{
"key": "ctrl+shift+space", // whatever, even "escape"
"command": "editor.action.triggerParameterHints",
"when": "editorHasSignatureHelpProvider && editorTextFocus"
},
{
"key": "ctrl+shift+space", // use same keybinding as above here fro toggle
"command": "closeParameterHints",
"when": "editorHasSignatureHelpProvider && editorTextFocus && parameterHintsVisible"
},

editor.action.indentLines does not work in VS Code

According to the default keyboard shortcuts documentation there is this shortcut:
{
"key": "cmd+]",
"command": "editor.action.indentLines",
"when": "editorTextFocus && !editorReadonly"
}
However it does not indent when I use it and adding a tab character instead.
I assume it is supposed to reindent the line according to the indentation rules (I use 4 spaces) - is that correct?
Thank you for help in advance!
Yes, that command will respect whatever indentation settings you have enabled for the current document. Try looking in the status bar for the current indentation setting:
Spaces:
Tabs:
Click on the spaces/tabs item to change the indentation setting for the file.
If you are still seeing unexpected behavior, please open a bug