VS Code中ftp-simple扩展上传时如何设置覆盖快捷键?
Fix ftp-simple Auto-Overwrite with Custom Shortcut in VS Code
I totally get that frustration—having to click "overwrite" every time you upload a file slows down your workflow. Let's set up that Ctrl+Alt+S shortcut to skip the confirmation prompt entirely:
Open Keyboard Shortcuts Settings
- Press
Ctrl+K Ctrl+S(or go toFile > Preferences > Keyboard Shortcuts) to open the shortcuts UI.
- Press
Edit the JSON Configuration
- Click the curly braces
{}icon in the top-right corner of the shortcuts panel to open yourkeybindings.jsonfile. This is where we'll add custom shortcut logic.
- Click the curly braces
Add the Auto-Overwrite Shortcut
- Paste this snippet into the file (make sure it's inside the existing array):
{ "key": "ctrl+alt+s", "command": "ftp-simple.upload.activeFile", "args": { "force": true }, "when": "editorFocus" } - Let's break this down:
key: Sets your desired shortcut (Ctrl+Alt+S).command: Targets the ftp-simple command for uploading the currently active file.args: { "force": true }: This is the magic—telling the extension to overwrite files without asking for confirmation.when: "editorFocus": Ensures the shortcut only works when you're focused on an editor tab (avoids accidental triggers).
- Paste this snippet into the file (make sure it's inside the existing array):
Optional: Extend to Folder Uploads
- If you want a similar shortcut for uploading entire folders, add this too:
{ "key": "ctrl+alt+shift+s", "command": "ftp-simple.upload.folder", "args": { "force": true }, "when": "explorerFocus" } - Here,
when: "explorerFocus"makes it work when you've selected a folder in the sidebar.
- If you want a similar shortcut for uploading entire folders, add this too:
Save the keybindings.json file, and you're good to go! Now pressing Ctrl+Alt+S will instantly upload your active file to the FTP server, no more confirmation clicks needed.
内容的提问来源于stack exchange,提问作者Bad Dobby
相关产品推荐
相关产品推荐

