文章目录
- Mac键盘符号
- eclipse(MacOS)模式下的快捷键
- General 通用
- Debugging 调试
- Search/ Replace 查询/替换
- Editing 编辑
- Refactoring 重构
- Navigation 导航
- Usage Search 使用查询
- VCS/ Local History 版本控制/本地历史记录
- Live Templates 动态代码模板
- Other 官方文档上没有体现
Mac键盘符号
| 图标 | 介绍 |
|---|
| ⌘ | Command |
| ⇧ | Shift |
| ⇪ | Caps Lock |
| ⌥ | Option = Alt |
| ⌃ | Control |
| ↩ | Enter |
| ⌫ | Delete |
| ⌦ | Fn + Delete |
| ↑ | 上箭头 |
| ↓ | 下箭头 |
| ← | 左箭头 |
| → | 右箭头 |
| ⇞ | Fn + ↑ = Page Up |
| ⇟ | Fn + ↓ = Page Down |
| Home | Fn + ← |
| End | Fn + → |
| ⇥ | Tab = 右制表符 |
| ⇤ | Shift + Tab = 左制表符 |
| ⎋ | Esc = Escape |
| ⏏ | 电源开关键 |
eclipse(MacOS)模式下的快捷键
General 通用
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Command + 0...Command + 9 | ⌘0…⌘9 | Open corresponding tool window | 打开相应编号的工具窗口 |
Command + S | ⌘S | Save all | 保存所有 |
Command + Option + Y | ⌘⌥Y | Synchronize | 同步、刷新 |
Command + Shift + F12 | ⌘⇧F12 | Toggle maximizing editor | 切换最大化编辑器 |
Option + Shift + I | ⌥⇧I | Inspect current file with current profile | 检查当前文件与当前的配置文件 |
| 无法正常显示 | ⌃` | Quick switch current scheme | 快速切换当前的scheme(切换主题、代码样式等) |
Command + , | ⌘, | Open Settings dialog | 打开IDEA系统设置 |
Command + ; | ⌘; | Open Project Structure dialog | 打开项目结构对话框 |
Command+3 | ⌘3 | Find Action | 查找动作(可设置相关选项) |
Control +Tab | ⌃⇥ | Edit window switch | 编辑窗口标签和工具窗口之间切换(如果在切换的过程加按上delete,则是关闭对应选中的窗口) |
Option + Shift + F | ⌥⇧F | Add Favorite | 添加到收藏夹 |
Control + Command + F | ⌃⌘F | Switch full screen | 切换全屏模式,最大化 |
Command+4 | ⌘+4 | | 隐藏显示run窗口 |
Shift+Control+R | ⇧⌃R | | 运行main方法 |
Debugging 调试
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
F6 | F6 | Step over | 进入下一步,如果当前行断点是一个方法,则不进入当前方法体内 |
F5 | F5 | Step into | 进入下一步,如果当前行断点是一个方法,则进入当前方法体内,如果该方法体还有方法,则不会进入该内嵌的方法中 |
Option + F5 | ⌥F5 | Smart step into | 智能步入,断点所在行上有多个方法调用,会弹出进入哪个方法 |
Option + F7 | ⌥F7 | step out | 跳出 |
Command+R | ⌘R | Run to cursor | 运行到光标处,如果光标前有其他断点会进入到该断点,建议改成Option+F9 |
Command+U | ⌘U | Evaluate expression | 计算表达式(可以更改变量值使其生效) |
F8 | F8 | Resume program | 恢复程序运行,如果该断点下面代码还有断点则停在下一个断点上 |
Shift+ Command + B | ⇧⌘B | Toggle breakpoint | 切换断点(若光标当前行有断点则取消断点,没有则加上断点) |
Shift +Command + F8 | ⇧⌘F8 | View breakpoints | 查看断点信息 |
Search/ Replace 查询/替换
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Double Shift | Double ⇧ | Search everywhere | 查询任何东西 |
Command + F | ⌘F | Find | 文件内查找 |
Command + K | ⌘K | Find next | 查找模式下,向下查找 |
Shift + Command + K | ⇧⌘K | Find previous | 查找模式下,向上查找 |
Command + R | ⌘R | Replace | 文件内替换 |
Control+H | ⌃H | Find in files | 全局查找(根据路径),在文件内搜索 |
Command + Shift+ R | ⌘⇧R | Replace in files | 全局替换(根据路径),和系统快捷键冲突,改成Shift+R |
Control+G | ⌃G | Select next occurrence | 选择下一个引用 |
Control+Command+G | ⌃⌘G | Select all occurrences | 选择所有引用 |
Control+G | ⌃G | Unselect occurrence | 取消选择引,和上面重复了,奇怪~ |
Command + Shift + S | ⌘⇧S | Search Structurally | 查询结构(Ultimate Edition 版专用,需要在Keymap中设置) |
Command + Shift + M | ⌘⇧M | Replace Structurally | 替换结构(Ultimate Edition 版专用,需要在Keymap中设置) |
Editing 编辑
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Control + Space | ⌃Space | Basic code completion | 基本的代码补全(补全任何类、方法、变量),代码智能提示,因为和切换输入法快捷键冲突,所以基本改成Alt+/ |
Shift + Option+Space | ⇧⌥Space | Smart code completion | 智能代码补全(过滤器方法列表和变量的预期类型 |
Command + Shift + Enter | ⌘⇧↩ | Complete statement | 自动结束代码,行末自动添加分号 |
Control+Shift + Space | ⌃⇧Space | Parameter info (within method call arguments) | 显示方法的参数信息 |
F2/Option+click | F2/⌥+click | Quick documentation lookup /Quick documentation | 显示当前位置的变量、方法的 Documentation 内容, 快速查看文档 |
Shift + F12 | ⇧F2 | External Doc | 查看外部文档(在某些代码上会触发打开浏览器显示相关文档) |
Control+ 鼠标放在代码上 | ⌃+mouse | Brief Info | 显示代码简要信息,这个和系统快捷键冲突了 |
Command + F1 | ⌘F1 | Show descriptions of error at caret | 在错误或警告处显示具体描述信息 |
Command + N, Control + Enter, Control + N | ⌘N, ⌃↩, ⌃N | Generate code… | 自动生成代码(getter、setter、构造函数、hashCode/equals,toString) |
Control + O | ⌃O | Override methods | 覆盖方法(重写父类方法) |
Control + I | ⌃I | Implement methods | 实现方法(实现接口中的方法) |
Option + Command + Z | ⌥⌘Z | Surround with… | 包围代码(使用if…else, try…catch, for, synchronized等包围选中的代码) |
Command+/ | ⌘/ | Comment/uncomment with line comment | 单行注释 |
Command + Option + / | ⌘⌥/ | Comment/uncomment with block comment | 块注释,多行注释 |
Shift + Control + / | ⇧⌃/ | Comment/uncomment with block comment | 块注释,多行注释 |
/** + enter | /** ↩ | Comment with method/class | 方法/类的说明注释 |
Shift +Control+ 方向键上 | ⇧⌃↑ | Extend selection | 连续选中代码块 |
Shift +Control+ 方向键下 | ⇧⌃↓ | Shrink selection | 减少当前选中的代码块 |
Control + Shift + Q | ⌃⇧Q | Context info | 显示上下文信息 |
Option + Enter | ⌥↩ | Show intention actions and quick-fixes | 显示意向动作和快速修复代码,无此动作 |
Shift+Command +F | ⇧⌘F | Reformat code | 格式化代码 |
Shift+ Command+ O | ⇧⌘O | Optimize imports | 优化import |
Command+ I | ⌘I | Auto-indent line(s) | 自动缩进线 |
Tab / Shift + Tab | ⇥ / ⇧⇥ | Indent/unindent selected lines | 缩进代码 / 反缩进代码 |
Command + X | ⌘X | Cut current line to clipboard | 剪切当前行或选定的块到剪贴板 |
Command + C | ⌘C | Copy current line to clipboard | 复制当前行或选定的块到剪贴板 |
Command + V | ⌘V | Paste from clipboard | 从剪贴板粘贴 |
Command + Shift + V | ⌘⇧V | Paste from recent buffers… | 从最近的缓冲区粘贴 |
Option+Command+↓ | ⌥ ⌘↓ | Duplicate current line | 复制光标所在行的内容,插入光标所在行下面 |
Command + D | ⌘D | Delete line at caret | 删除当前行或选定的块的行,删除光标所在行 |
Control + Shift + J | ⌃⇧J | Smart line join | 智能的将代码拼接成一行 |
Command + Enter | ⌘↩ | Smart line split | 智能的拆分拼接的行 |
Shift + Enter | ⇧↩ | Start new line | 开始新的一行,光标所在行下方插入空白行 |
Option+Command+enter | ⌥⌘↩ | | 光标所在行上方插入空白行 |
Option+Command +→ /Command+F6 | ⌥⌘→/⌘F6 | select next tab | 选择下个tab,使用F6需要配合FN才行 |
Option+Command +←Shift+Command+F6 | ⌥⌘←/Shift⌘F6 | select previous tab | 选择上一个tab |
Command + Shift + ] / Command + Shift + [ | | Select till code block end/ start | 选择直到代码块结束/开始,不存在此快捷键 |
Command+ Fn + Delete | (⌦键为Fn+Delete)⌘ ⌦ | Delete to word end | 删除到单词的末尾 |
Command + Delete | ⌘⌫ | Delete to word start | 删除到单词的开头 |
Command + 加号 / Command + 减号 | ⌘+ / ⌘- | Expand/collapse code block | 展开 / 折叠代码块 |
Command + Shift + 加号 | ⌘⇧+ | Expand all | 展开所有代码块 |
Command + Shift + 减号 | ⌘⇧- | Collapse all | 折叠所有代码块 |
Command + W | ⌘W | Close active editor tab | 关闭活动的编辑器选项卡 |
Option+上下箭头 | ⌥ +上下箭头 | Move current line of code | 移动当前代码行 |
Option+enter | ⌥ ↩ | | 导入包,自动修正代码,可以自动补齐代码语句 |
Shift+Option+enter | ⇧⌥ ↩ | | 导入包,自动修正代码 |
Option+→ | ⌥→ | move to next word | 移到下一个单词 |
Option+← | ⌥← | move to previous word | 移到上一个单词 |
Command+delete | ⌘⌫ | | 删除光标前面的单词 |
Command+→ | ⌘→ | | 移到行尾 |
Command+← | ⌘← | | 移到行首 |
Command+Shift+→ | ⌘⇧→ | | 选中当前位置到行尾 |
Command+Shift+← | ⌘⇧← | | 选中当前位置到行首 |
Shift+Command+X | | | 选中部分全部大小写切换 |
sout | | | System.out.println() |
fori | | | for (int i = 0; i < ; i++) {} |
Refactoring 重构
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
F5 | | Copy | 复制文件到指定目录,改成Option+C |
Option+Command+V | ⌥⌘V | Move | 移动文件到指定目录 |
Option+Shift+Enter | ⌥⇧↩ | Safe Delete | 安全删除 |
Shift+F6 | ⇧F6 | Rename | 重命名 |
Control+T | ⌃T | Refactor this | 重构这个 |
Option+Command + C | ⌥⌘C | Change Signature | 更改签名,改成Option+Command+S |
Option + Command + I | ⌥⌘I | Inline | 一致性 |
Option + Command + M | ⌥⌘M | Extract Method | 将选中的代码提取为方法,选中部分抽取为方法 |
Option +Command + L | ⌥⌘L | Introduce Variable | 引入变量 |
Option +Command + F | ⌥⌘F | Introdue Field | 引入字段 |
Command + Option + C | ⌘⌥C | Introduce Constant | 提取常量 |
Command + Option + P | ⌘⌥P | Introduce Parameter | 提取参数 |
Navigation 导航
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Shift+Command + T | ⇧⌘T | Go to class | 查找类文件 |
Shift + Command + R | ⌘⇧R | Go to file | 查找所有类型文件、打开文件、打开目录,打开目录需要在输入的内容前面或后面加一个斜杠 / |
Command + Option + O | ⌘⌥O | Go to symbol | 前往指定的变量 / 方法,选中方法名或者变量,查找方法或者变量 |
Control + 方向键左 / Control + 方向键右 | ⌃← / ⌃→ | Go to next/previous editor tab | 左右切换打开的编辑tab页,这个快捷键不对 |
F12 | | Go back to previous tool window | 返回到前一个工具窗口 |
Esc | ⎋ | Go to editor (from tool window) / focus editor | 从工具窗口进入代码文件窗口 |
Shift + Esc | ⇧⎋ | Hide active or last active tool window | 隐藏当前或最后一个活动的窗口,且光标进入代码文件窗口 |
Command + L | ⌘L | Go to line | 在当前文件跳转到某一行的指定处,跳转到指定的行 |
Command + Shift + F4 | ⌘⇧F4 | 未知 | 关闭活动run/messages/find/… tab |
Command + E | ⌘E | Recent files popup | 显示最近打开的文件记录列表 |
Command + [ / Command + ] | ⌘[/ ⌘] | Navigate back/ forward | 退回 / 前进到上一个操作的地方 |
Command + Shift + Delete | ⌘⇧⌫ | Navigate to last edit location | 跳转到最后一个编辑的地方 |
Option + Command+W | ⌥⌘W | Select current file or symbol in any view /select in… | 显示当前文件选择目标弹出层,弹出层中有很多目标可以进行选择(如在代码编辑窗口可以选择显示该文件的Finder) |
F3 / Control + 鼠标点击 | ⌘B / ⌘ +click | Go to declaration | 进入光标所在的方法/变量的声明处 |
Command + Option + B | ⌘⌥B | Go to implementation(s) | 选择方法名,跳转到实现处,在某个调用的方法名上使用会跳到具体的实现处,可以跳过接口,改成Control+Option+I |
Option + Space, Command + Y | ⌥ Space, ⌘Y | Open quick definition lookup /quick definition | 快速打开光标所在方法、类的定义 |
Control + Shift + B | ⌃⇧B | Go to type declaration | 选中类名,跳转到类型声明处 |
Command + U | ⌘U | Go to Super Method | 前往当前光标所在方法的父类的方法 / 接口定义 |
Control + Option+方向键下 / Control + Option+方向键上 | ⌃⌥↓ / ⌃⌥↑ | previous/next method | 当前光标跳转到当前文件的前一个/后一个方法名位置,跳到下一个/上一个成员函数或成员变量 |
Control + ] / Control+Shift+P | ⌃]/⌃⇧P | Move Caret to code block end | 移动光标到当前所在代码块的结束位置,即跳转到最近的大括号位置 |
Option+Command+[ | ⌥ ⌘[ | Move Caret to code block start | 移动光标到当前所在代码块的开始位置 |
Command + O | ⌘O | File structure popup | 弹出当前文件结构层,可以在弹出的层上直接输入进行筛选(可用于搜索类中的方法), 查看当前类成员信息 |
F4 | F4 | Type hierarchy | 显示当前类的层次结构 |
Command + Shift + H | ⌘⇧H | Method hierarchy | 显示方法层次结构 |
Control + Option + H | ⌃⌥H | Call hierarchy | 显示调用层次结构 |
Shift+Command+. | ⇧⌘. | previous highlighted error | 跳转到上一个突出错误或警告的位置 |
Shift+Command+ G | ⇧⌘G | | 查找引用 |
Command+. | ⌘. | Next highlighted error | 跳转到下一个突出错误或警告的位置,查看代码警告 |
F3 | F3 | Edit source/View source /jump to source | 编辑/查看代码源 |
Option + Home | ⌥ Home | Show navigation bar | 显示到当前文件的导航条 |
F9 | | Toggle bookmark | 选中文件/文件夹/代码行,添加/取消书签 |
Option + F3 | ⌥F3 | Toggle bookmark with mnemonic | 选中文件/文件夹/代码行,使用助记符添加/取消书签 |
Control + 0...Control + 9 | ⌃0…⌃9 | Go to numbered bookmark | 定位到对应数值的书签位置 |
Command + F3 | ⌘F3 | Show bookmarks | 显示所有书签 |
Usage Search 使用查询
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Shift+Command+G | ⇧⌘G | Find usages | 在类中查找用法 |
Shift+Command+U | ⇧⌘U | Find usages in file | 在文件中查找用法 |
Command + Shift + F7 | ⌘⇧F7 | Highlight usages in file | 在文件中突出显示的用法 |
Command + Option + F7 | ⌘⌥F7 | Show usages | 显示用法 |
Command+Shift+I | ⌘⇧I | | 查看定义的类,快速查看 |
VCS/ Local History 版本控制/本地历史记录
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Command + K | ⌘K | Commit project to VCS/Commit | 提交代码到版本控制器 |
Command + T | ⌘T | Update project from VCS | 从版本控制器更新代码 |
Option+Command+K | ⌥⌘K | Push commits | 推送提交 |
Control + V | ⌃V | ‘VCS’ quick popup/VCS Operations | “VCS”快速弹出窗口 |
Option + Shift + C | ⌥⇧C | Recent Changes | 查看最近的变更记录 |
Control + C | ⌃C | ‘VCS’ quick popup | 快速弹出版本控制器操作面板,没有此动作 |
Live Templates 动态代码模板
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Option +Command + Z | ⌥⌘Z | Surround with Live Template | 弹出模板选择窗口,将选定的代码使用动态模板包住,就是添加if/else,try/catch等块 |
Command + J | ⌘J | Insert Live Template | 插入自定义动态代码模板 |
Other 官方文档上没有体现
| 快捷键 | 快捷键符号 | 英文名称 | 功能说明 |
|---|
Command + Shift +8 | ⌘⇧8 | column selection mode | 竖编辑模式 |
说明:删除线的快捷键表示软件默认没有此快捷键,你需要自己去设置
忠告:开发工具适合自己的就可以了,你熟悉使用eclipse就使用eclipse,你熟悉使用idea就使用idea,如果你希望使用idea又使用eclipse,又不想记住两套快捷键这是不可能的,通过对比发现在idea中使用eclipse(MacOS)的快捷键,很多地方需要自定义且和eclipse for Mac默认的快捷键也有很多地方不同,所以使用idea的同学建议记住MacOS模式下的快捷键为佳!