Skip to content
Published at:

Shortcuts ​

General ​

  • Show Command Palette: ⇧⌘P, F1
  • Quick Open, Go to File...: ⌘P
  • User Settings: ⌘,

Basic editing ​

  • Toggle line comment: ⌘/

Search and replace ​

  • Find: ⌘F
  • Select all occurrences of Find match: ⌥Enter
  • Add selection to next Find match: ⌘D

Rich languages editing ​

  • Trigger suggestion: ⌃Space, ⌘I
  • Go to Definition: F12
  • Peek Definition: ⌥F12
  • Quick Fix: ⌘.
  • Rename Symbol: F2
  • Show all Symbols: ⌘T
  • Go to Line...: ⌃G
  • Go to File...: ⌘P
  • Go to Symbol...: ⇧⌘O
  • Go to next/previous error or warning: F8/⇧F8

Display ​

  • Toggle Sidebar visibility: ⌘B
  • Toggle Panel visibility: ⌘J
  • Focus into Primary Side Bar: ⌘0
  • Focus First Editor Group: ⌘1

Debug ​

  • Toggle breakpoint: F9
  • Start/Continue: F5
  • Step into/ out: F11 / ⇧F11
  • Step over: F10

Integrated terminal ​

  • Show integrated terminal: `⌃``
  • Scroll up/down: ⌘↑ / ↓

Recommand Settings ​

json
{
  "editor.cursorSurroundingLines": 8, // 光标周围显示行数
  "editor.fontFamily": "JetBrains Mono", // 为程序员设计的字体
  "editor.formatOnSave": true, // 保存的时候自动格式化
  "files.trimTrailingWhitespace": true, // 去掉结束的空格
  "files.autoSaveDelay": 100, // 自动延时保存
  "files.autoSave": "afterDelay", // 自动保存
  "vim.leader": ",", // 设置Vim的leader键
  "terminal.integrated.copyOnSelection": true, // 选中自动复制
  "terminal.integrated.scrollback": 1000000 // 终端滚动行数
}

Tips and Tricks ​

命令太多 ​

用⇧⌘P, F1去搜索,会面会显示快捷键

大文件滚动太慢 ​

按住⌘键在滚动鼠标滚轮

各种命名风格转换 ​

VSCode 命令:

  • Transform to Camel Case(驼峰命名法)
  • Transform to Kebab Case(串式命名法)
  • Transform to Snake Case(蛇形命名法)
  • Transform to Title Case(首字母大写)
  • Transform to Lower Case(小写)
  • Transform to Upper Case(大写)

// TODO

Plugins ​

VSCodeVim ​

VSCode 的 Vim 插件实现了一些 Vim 插件的功能

vim-surround ​

Surround CommandDescription
y s <motion> <desired>Add desired surround around text defined by <motion>
d s <existing>Delete existing surround
c s <existing> <desired>Change existing surround to desired
S <desired>Surround when in visual modes (surrounds full selection)

Some examples:

  • "test" with cursor inside quotes type cs"' to end up with 'test'
  • "test" with cursor inside quotes type ds" to end up with test
  • "test" with cursor inside quotes type cs"t and enter 123> to end up with <123>test</123>

vim-commentary ​

加注释: Line和Block

  • gc - toggles line comment. For example gcc
  • gC - toggles block comment. For example gCi)

vim-sneak ​

转跳连续的两个字符

Motion CommandDescription
s<char><char>Move forward to the first occurrence of <char><char>
S<char><char>Move backward to the first occurrence of <char><char>
<operator>z<char><char>Perform <operator> forward to the first occurrence of <char><char>
<operator>Z<char><char>Perform <operator> backward to the first occurrence of <char><char>

GitHub Copilot ​

  • Trigger inline suggestion: Option: (⌥)+\
  • Open GitHub Copilot: Ctrl+Return
  • Show next inline suggestion: Option (⌥)+]
  • Show previous inline suggestion: Option (⌥)+[