Ubuntu 24.04下Visual Studio Code手动配置快捷键的存储位置及恢复方法
VS Code快捷键配置存储位置与CLI恢复方法
配置文件存储路径
VS Code的自定义快捷键配置保存在keybindings.json文件中,不同系统的具体路径如下:
- Windows:
%APPDATA%\Code\User\keybindings.json - macOS:
$HOME/Library/Application Support/Code/User/keybindings.json - Linux:
$HOME/.config/Code/User/keybindings.json
通过CLI在新系统恢复配置
- 先将你的
keybindings.json纳入dotfiles仓库管理,确保文件已同步到仓库中。 - 在新系统完成VS Code安装后,执行对应系统的CLI命令,将仓库中的配置文件复制到VS Code的用户配置目录:
- Windows(PowerShell):
Copy-Item -Path "你的dotfiles仓库中keybindings.json的路径" -Destination "$env:APPDATA\Code\User\keybindings.json" -Force - macOS(Bash/Zsh):
cp 你的dotfiles仓库中keybindings.json的路径 ~/Library/Application\ Support/Code/User/keybindings.json - Linux(Bash/Zsh):
cp 你的dotfiles仓库中keybindings.json的路径 ~/.config/Code/User/keybindings.json
- Windows(PowerShell):
- 重启VS Code,自定义快捷键配置即可生效。
内容的提问来源于stack exchange,提问作者reducing activity
相关产品推荐
相关产品推荐

