问题
How can we save all the files in Visual Studio Code like we do in Visual Studio by pressing Ctrl+Shift+S ?
回答1:
Doesn't look like there is a shortcut binding to it.
Simplest way would be to use the menu accelerators: ALT+f followed by ALT+l.
To change your key binding edit the keyboard preferences.
Add the binding to the right half of the screen and then restart Code:
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+s",
"command": "workbench.action.files.saveAll"
}
]
回答2:
⌥+⌘+S // macOS
Ctrl+K S // Windows
Ctrl+Alt+S // Linux
回答3:
In visual studio code as of today you can press Ctrl + K + S to save all unsaved files currently opened in your editor.
A word of caution
about keyboard shortcut combinations present in description text of menu items:
The trick to note here is that the command key combination [Ctrl+K S]
shown with menu item text gives an impression that you have to press Ctrl key, keep the Ctrl key pressed and then press the keys K and S one by one in quick succession. This is not the case.
After having pressed Ctrl + K combination, release both the Ctrl and K keys and then press S key separately. For cases where Ctrl key has to be kept pressed continuously, it will be shown as e.g. [Ctrl + K Ctrl + O]
(to open a new folder) in the menu item text .
回答4:
For windows user - Visual Studio Code has Ctrl + K , S
- Press Ctrl key + K.
- Release the Ctrl and K both keys.
- Press S key.
This will Save all modified files in one go. Release is the main point as new user press S key with Ctrl key which opens key board shortcuts file.
回答5:
For Windows users, the key shortcut is displayed as the 11th option in the "File" menu as:
Save All Ctrl + K S
The key shortcut displayed equates to the following:
Press Ctrl + k
Release the Ctrl and k keys.
Notice the bottom of your window will display a message asking for a second key like this:
- Press s.
This applies to other "Close Workspace" command that can be found in the "File" menu (instead of pressing s, you press f).
回答6:
This keybindings.json switches the Save All
and Save
shortcuts so that Cmd+S is bound to Save All
:
[
{
"key": "alt+cmd+s",
"command": "workbench.action.files.save"
},
{
"key": "cmd+s",
"command": "-workbench.action.files.save"
},
{
"key": "cmd+s",
"command": "workbench.action.files.saveAll"
},
{
"key": "alt+cmd+s",
"command": "-workbench.action.files.saveAll"
}
]
回答7:
ctrl + shift + s
Is supported in latest versions My version is: 1.39.1
来源:https://stackoverflow.com/questions/37014171/how-can-we-save-all-files-in-vscode-like-we-do-in-visual-studio