How can we save all files in (VSCode) like we do in Visual Studio

Visual StudioKeyboard ShortcutsVisual Studio-Code

Visual Studio Problem Overview


How can we save all the files in Visual Studio Code like we do in Visual Studio by pressing Ctrl+Shift+S ?

Visual Studio Solutions


Solution 1 - Visual Studio

It doesn't look like VS Code has a built-in single-press keyboard shortcut to save all open files on Windows.

The simplest way would be to use the menu accelerators: ALT+F, followed by ALT+L.

Alternatively, you can change the key binding by editing the keyboard preferences:

VS Code with File menu open, Preferences, Keyboard Shortcuts highlighted

Add the binding to the right half of the screen, then restart VS Code:

// Place your key bindings in this file to overwrite the defaults
[    {       "key": "ctrl+shift+s",       "command": "workbench.action.files.saveAll"     }]

enter image description here

Solution 2 - Visual Studio

++S // macOS

Ctrl+K S // Windows

Ctrl+Alt+S // Linux

Solution 3 - Visual Studio

TL;DR; You can press Ctrl + K , S to save all open files with a little caveat associated with it.

Details: Please be careful about keyboard shortcut combination shown in any menu description. There is a little caveat about it. The combination Ctrl + K S shown as menu description text gives an impression that we 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.

enter image description here

After having pressed Ctrl + K combination, you need to release both Ctrl and K keys and then press S key separately.

For cases where Ctrl key has to be kept pressed continuously, you'll notice that modifier keys will appear twice in the menu description text. For example, to open a new folder, the menu item's text shows Ctrl + K Ctrl + O. In this case Ctrl modifier key is present twice as shown in the screenshot below:

enter image description here

Solution 4 - Visual Studio

For windows user - Visual Studio Code has Ctrl + K , S

  1. Press Ctrl + K.
  2. Release the Ctrl and K both keys.
  3. 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.

Solution 5 - Visual Studio

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:

  1. Press Ctrl + k

  2. Release the Ctrl and k keys.

Notice the bottom of your window will display a message asking for a second key like this:

VSCode bottom status message after pressing <kbd>Ctrl</kbd> + <kbd>k</kbd>.

  1. Press s.

This applies to other "Close Workspace" command that can be found in the "File" menu (instead of pressing s, you press f).

Solution 6 - Visual Studio

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"    }]

Solution 7 - Visual Studio

> First of All, I want you to check, What is your VS Code default shortcut for 'Save All' files

Step 1: Open VS Code> 'File' Tab > 'Preferences'> ClickOn 'Keyboard Shortcuts'

> Secondly, I want you to search for 'Save All' Shortcut.

Step 2: Type 'Save All' in Search Field

> Third, you will see that shortcut keybinding to the 'Save All' Command.

Step 3: You can also change the keybinding to it. Just clicking on it and adding controls of your choice and then press enter.

Solution 8 - Visual Studio

I'm a jack of all trades developer, using lots of different tools and operating systems. I'm always nervous about blindly using keystrokes. I much prefer to use a simple "save all" button.

Save All Icon in VSCode

If you add "Open Editors" in your VS Code Explorer window, that selection includes a very handy "Save All" icon. Click the icon, and you are done.

No custom keystrokes required. No preferences to edit.

Solution 9 - Visual Studio

As of May 2020 (version 1.46) In Mac the shortcut key is:

> Option + Command + s

Solution 10 - Visual Studio

To save all the files in VSCode(Windows),

Press Ctrl+K then Press the S.

All files will be saved.

To find other keyboard shortcuts or to change a shortcut,

Go to File -> Preferences -> Keyboard Shortcuts OR Press Ctrl+K+S

Select a keyboard shortcut and press Enter to update/change a keybinding

Solution 11 - Visual Studio

ctrl + shift + s

Is supported in latest versions My version is: 1.39.1

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrashfmnbView Question on Stackoverflow
Solution 1 - Visual StudiojessehouwingView Answer on Stackoverflow
Solution 2 - Visual StudioTomoJView Answer on Stackoverflow
Solution 3 - Visual StudioRBTView Answer on Stackoverflow
Solution 4 - Visual StudioGaurav UpadhyayView Answer on Stackoverflow
Solution 5 - Visual StudiolewdevView Answer on Stackoverflow
Solution 6 - Visual StudioBlaiseView Answer on Stackoverflow
Solution 7 - Visual StudioSandeep DalalView Answer on Stackoverflow
Solution 8 - Visual StudiozipzitView Answer on Stackoverflow
Solution 9 - Visual StudiohasnView Answer on Stackoverflow
Solution 10 - Visual StudioLenzmanView Answer on Stackoverflow
Solution 11 - Visual StudioNaor LeviView Answer on Stackoverflow