Tools - Editor - Visual Studio Code

闷骚的程序员

快捷键

C –> Ctrl

S –> Shift

M –> Alt

Cmd –> Command

功能WindowsMac OS X
打开文件C-o 
打开文件夹C-k C-o 
关闭文件夹C-k f 
命令面板C-S-p 
资源管理器C-S-e 
搜索C-S-f 
GitC-S-g 
调试C-S-d 
插件C-S-x 
Markdown 侧边预览C-k v 
Markdown 预览C-S-v 

使用 VSCode 作为 mergetool

编辑 ~/.gitconfig 文件,添加如下内容:

[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED

需要的时候执行 git mergetool 就会调起了。

参考:https://blog.kulman.sk/using-vscode-as-git-merge-tool/

使用 VSCode 作为 git commit message 编辑器

git config --global core.editor "code -w"

VSCodeVim 支持按键重复

在 macOS,默认情况 VSCodeVim 模式下是不支持按键重复的,比如你在 Normal 模式下长按 L,结果光标只向右移动了一次,而没有像你预期的那样一直移动。

启用按键重复的方法在插件的 REAME 有说明,链接:https://github.com/VSCodeVim/Vim#mac

方法:

按需执行下面的某一行命令并重启 VSCode。

$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false         # For VS Code
$ defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
$ defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false    # For VS Codium
$ defaults delete -g ApplePressAndHoldEnabled                                      # If necessary, reset global default

如果有需要,调整「系统偏好设置」—「键盘」里的「按键重复」和「重复前延迟」。

在命令行使用 code 命令启动 VSCode

默认并不支持,但可以使用以下方式开启:

command+shift+p 打开命令面板,输入 shell,选择 Shell Command: Install 'code' command in PATH

  • code . 打开当前目录;
  • code -n . 在窗口打开当前目录;
  • code -r . 复用现有窗口打开当前目录;
  • code -g <file:line:column> 打开指定文件并跳转到指定行列;

code -h 查看更多命令。

文档信息

Search

    Table of Contents