How do I disable the auto-quotes feature?
When I hit the ' or " key, I do not EVER want it to automatically insert another one anywhere. No matter how smart they make it, it just comes across to me as "unpredictable" and distracts me from what I'm trying to do.
I type over 100 wpm, I really don't need help hitting the ' or " key.
I have tried the following settings, but none of them have disabled this undesired behavior:
{
"editor.autoClosingBrackets": false,
"editor.wordWrap": "off",
"html.autoClosingTags": false,
"editor.formatOnType": false,
"editor.suggestOnTriggerCharacters": false,
"editor.acceptSuggestionOnEnter": "off",
}
Put this in your user settings:
"editor.autoClosingQuotes": "never"
Edit: from vscode 1.27.0
"editor.autoClosingQuotes": "never",
"editor.autoSurround": "never",// When the word is selected
I guess you can "type" them instead like this (keybindings.json):
{
"key": "'",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "'"
},
"when": "editorTextFocus && !editorReadonly"
},
Here is a GUI-How-To-Change it:
Open the Settings-Dialog:
Press Strg + , or Navigate with mouse to File | Settings
Change the Value of:
editor.autoClosingQuotes to the desired never
Thats it, no step 3 - only upvote my screenshot-answer..
In addition to the accepted answer, I also had to disable "HTML: Auto Create Quotes" in preferences (search for "Quote")
File > Preferences > Settings > type "quote" in search box
Open Settings (File -> Preferences -> Settings) Ctrl+Comma
Search for "editor close"
You should find "Auto Closing Brackets" and "Auto Closing Quotes".
Change them to "never ever"!
Related
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.
Whenever there is some missing or needs correction in code, visual studio code shows a yellow bulb to show some quick fixes suggestions.
Is there any way or shortcut by which we can navigate up and down suggestion options shown as in screenshot above without using the arrow keys?
In vscode v1.71 there are three new commands you can use for navigating in the QuickFix menu to go to previous or next source code actions.
selectNextCodeAction // to focus the nextcode action
selectPrevCodeAction // to focus the previous code action
acceptSelectedCodeAction // to run the focused/selected code action
You can see the default keybindings below that have been removed. Note the - before the command name in two of the keybindings, that removes those keybindings.
You can make these keybindings (in your keybindings.json):
{
"key": "alt+u", // whatever you want here
"command": "selectPrevCodeAction", // for v1.71
"when": "CodeActionMenuVisible"
},
{
"key": "up", // default removed
"command": "-selectPrevCodeAction", // for v1.71
"when": "CodeActionMenuVisible"
},
{
"key": "alt+d", // whatever you want here
"command": "selectNextCodeAction", // for v1.71
"when": "CodeActionMenuVisible"
},
{
"key": "down", // default removed
"command": "-selectNextCodeAction", // for v1.71
"when": "CodeActionMenuVisible"
}
--------
There is also an extension presented as a fix:
Keyboard QuickFix, but it shouldn't be necessary anymore.
Go to "Keyboard shortcuts" and search for selectNextSuggestion.
You can rebind this command to any shortcut you like.
Same goes for selectPrevSuggestion.
I use cmd + j for up and cmd cmd + k for down ^^
I often need to open and make small changes to projects which use different code formatting options than the ones I use. In order not to reformat the whole file, I usually open the user settings, search for settings containing "format", and then disable the options Editor: Format On Paste, Editor: Format On Save, Editor: Format On Type. When I return to my projects, I re-enable those options.
I would like this to be simpler, such as, binding a keyboard shortcut to quickly toggle all three of those options. However, I could not find shortcut actions that could bind to those.
Does anyone know if what I'm trying to achieve is possible?
You can do this with an extension: Toggle, which allows you to toggle many settings at the same time.
In your keybindings.json:
{
"key": "alt+capslock", // whatever keybinding you wish
"command": "toggle",
"when": "editorTextFocus",
"args": {
"id": "toggleFormats",
"value": [
{
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"window.enableMenuBarMnemonics": false
},
{
"editor.formatOnType": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"window.enableMenuBarMnemonics": true
}
]
}
},
I haven't tested it but it should work.
The only problem is there is no visual indicator which state you are in - perhaps you can find some other setting to toggle that would do so and be "innocuous." That is why I threw enableMenuBarMnemonics in there, on my keyboard the capslock key lights up when the formats are set to false and you can also check by doing alt+F to see if the main menu File option is opened. You may not need a visual reminder to indicate the state or come up with a better one.
I would like to have the following feature on VSCode and I don't know if it is possible. For example, if I have this line :
I would like to emphasize this.
I would just select this, clic on a shortcut like ctrl+i and then this appears :
I would like to emphasize {i}this{/i}.
I use a lot of {i} and {/i} tags in my project so this would help me save an incredible amount of time !
I know VSCode already does something similar when you select a word and clic on "
Find your keybindings.json file and insert the following snippet:
{
"key": "ctrl+i",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "{i}$TM_SELECTED_TEXT{/i}"
},
"when": "editorTextFocus && editorHasSelection"
}
Key bindings can be found by pressing Ctrl+Shift+P > type "Keyboard shortcuts", full name being: Open Keyboard Shortcuts (JSON).
In chrome and most other browsers/editors, we can go to a particular tab by pressing the Command key and the number. For example: If we press Command+1 we will go to the first tab, Command+2 takes to the second tab, etc.
Is it possible to get such a key mapping for Visual studio code ?
Since VSCode uses ctrl+number by default (which changes desktops in macOS), you can use cmd+number with custom keybindings:
Paste this in your keybindings.user:
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "cmd+2",
"command": "workbench.action.openEditorAtIndex2"
},
{
"key": "cmd+3",
"command": "workbench.action.openEditorAtIndex3"
},
{
"key": "cmd+4",
"command": "workbench.action.openEditorAtIndex4"
},
{
"key": "cmd+5",
"command": "workbench.action.openEditorAtIndex5"
},
{
"key": "cmd+6",
"command": "workbench.action.openEditorAtIndex6"
},
{
"key": "cmd+7",
"command": "workbench.action.openEditorAtIndex7"
},
{
"key": "cmd+8",
"command": "workbench.action.openEditorAtIndex8"
},
{
"key": "cmd+9",
"command": "workbench.action.openEditorAtIndex9"
},
This is available now, with the latest version of Visual Studio Code. See: https://github.com/Microsoft/vscode/issues/24753#issuecomment-294518439
On macOS, the shortcuts default to ctrl + n, not cmd + n. You can fix that in Code -> Preferences -> Keyboard Shortcuts.
Another note: most other apps activate the last tab with cmd + 9. You get that behavior by using workbench.action.lastEditorInGroup instead of workbench.action.openEditorAtIndex9.
Unfortunately, no. But you can configure shortcuts to move between tabs, such as going to the previous, next, previously modified, etc. tabs. You can make changes in the Options menu under Keyboard.
This comes standard with the "Emacs Keymap" extension as well as a multitude of other "never touch the mouse" keybindings that I, personally, find keep my stress level way down while navigating code.
Now all I need to find is a way to put the tab's number on the tab itself (which is what I was searching when I found this question).