外观
快捷键
约 476 字大约 2 分钟
2025-06-19
目录
自定义快捷键
在 Sublime Text 中,打开 Preferences → Key Bindings - User,可以添加自己的快捷键映射。
[
// 移动行
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
// 复制行
{ "keys": ["ctrl+alt+up"], "command": "duplicate_line" },
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
// 大小写转换
{ "keys": ["ctrl+shift+x"], "command": "upper_case" },
{ "keys": ["ctrl+shift+y"], "command": "lower_case" },
// 删除行
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
// 行跳转
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
// 自动补全
{ "keys": ["alt+/"], "command": "auto_complete" },
// 编辑历史导航
{ "keys": ["alt+left"], "command": "jump_back" },
{ "keys": ["alt+right"], "command": "jump_forward" },
// 文件导航
{ "keys": ["ctrl+shift+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
// 符号跳转(方法/函数)
{ "keys": ["ctrl+o"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
// 选中相同内容
{ "keys": ["ctrl+down"], "command": "find_under_prev" },
// 函数定义跳转
{ "keys": ["f3"], "command": "godef" }
]常用快捷键速查
| 按键 | 说明 |
|---|---|
Ctrl + P | 快速打开文件 |
Ctrl + G | 跳转到指定行 |
Ctrl + Shift + P | 打开命令面板 |
Ctrl + D | 选中当前词,再次按下选中下一个相同词(多选) |
Ctrl + Shift + L | 将选中的每行分为一个光标 |
Ctrl + Shift + M | 选中当前括号内容 |
Ctrl + Alt + ↑/↓ | 上下复制行 |
Ctrl + Shift + K | 删除行 |
Ctrl + / | 注释/取消注释 |
Ctrl + Shift + / | 块注释 |
Ctrl + F | 查找 |
Ctrl + H | 查找替换 |
Alt + F3 | 选中所有相同单词 |
Ctrl + J | 合并选中行 |
Ctrl + Shift + V | 粘贴并格式化 |
Ctrl + Z | 撤销(二次撤销可恢复被撤销的选中) |
Ctrl + Enter | 在当前行下方插入新行 |
Ctrl + Shift + Enter | 在当前行上方插入新行 |
Mac 键位说明
在 macOS 上,Super(⌘ Command)键等同于 Windows/Linux 上的 Ctrl 键。例如:
Ctrl + D(Windows)→⌘ + D(Mac)Ctrl + Shift + R(Windows)→⌘ + ⇧ + R(Mac)
