IDEA快捷键大全
![](https://up.ctext.top/article/2024/10/idea.png)
AI-摘要(由百度千帆大模型提供生成摘要能力)
Tianli GPT
AI初始化中...
介绍自己 🙈
生成本文简介 👋
推荐相关文章 📖
前往主页 🏠
前往爱发电购买
IDEA快捷键大全
伴随IDEA快捷键大全
Editing/编辑
快捷键 | 介绍 |
---|---|
Ctrl + Space | Basic code completion (the name of any class, method or variable)基础代码补全,默认在 Windows 系统上被输入法占用,需要进行修改,建议修改为 Ctrl + 逗号 |
Ctrl + Shift + Space | Smart code completion (filters the list of methods and variables by expected type)智能代码提示 |
Ctrl + Shift + Enter | Complete statement(自动结束代码,行末自动添加分号) |
Ctrl + P | Parameter info (within method call arguments)方法参数提示显示 |
Ctrl + Q | Quick documentation lookup(光标所在的变量 / 类名 / 方法名等上面(也可以在提示补充的时候按),显示文档内容) |
Shift + F1 | External Doc/如果有外部文档可以连接外部文档 |
Ctrl +光标悬浮 | Brief Info/按 Ctrl 不要松开,会显示光标所在的类信息摘要 |
Ctrl + F1 | Show descriptions of error or warning at caret/在光标所在的错误代码出显示错误信息 |
Alt + Insert | Generate code… (Getters, Setters, Constructors, hashCode/equals, toString)代码自动生成,如生成对象的 set / get 方法,构造函数,toString() 等 |
Ctrl + O | Override methods/选择可重写的方法 |
Ctrl + I | Implement methods/选择可继承的方法 |
Ctrl + Alt + T | Surroundwith…(if…else,try…catch, for, synchronized, etc.)对选中的代码弹出环绕选项弹出层 |
Ctrl + / | Comment/uncomment with line comment/注释光标所在行代码,会根据当前不同文件类型使用不同的注释符号 |
Ctrl + Shift + / | Comment/uncomment with block comment/代码块注释 |
Ctrl + W | Select successively increasing code blocks/递进式选择代码块。可选中光标所在的单词或段落,连续按会在原有选中的基础上再扩展选中范围 |
Ctrl + Shift + W | Decrease current selection to previous state/递进式取消选择代码块。可选中光标所在的单词或段落,连续按会在原有选中的基础上再扩展取消选中范围 |
Alt + Q | Context info/弹出一个提示,显示当前类的声明 / 上下文信息 |
Alt + Enter | Show intention actions and quick-fixes/根据光标所在问题,提供快速修复选择,光标放在的位置不同提示的结果也不同 |
Ctrl + Alt + L | Reformat code/格式化代码,可以对当前文件和整个包目录使用 |
Ctrl + Alt + O | Optimize imports/优化导入的类,可以对当前文件和整个包目录使用 |
Ctrl + Alt + I | Auto-indent line(s)光标所在行 或 选中部分进行自动代码缩进,有点类似格式化 |
Tab / Shift + Tab | Indent/unindent selected lines/缩进/取消缩进选定的行 |
Ctrl+X | Cut current line or selected block to clipboard/将当前行或选定块剪切到剪贴板 |
Ctrl+C | Copy current line or selected block to clipboard/将当前行或选定块复制到剪贴板 |
Ctrl+V | Paste from clipboard/从剪贴板粘贴 |
Ctrl+Shift + V | Paste from recent bu"ers…/粘贴从最近的但是… |
Ctrl+D | Duplicate current line or selected block/复制光标所在行 或 复制选择内容,并把复制内容插入光标位置下面 |
Ctrl+Y | Delete line at caret/删除光标所在行 或 删除选中的行 |
Ctrl+Shift + J | Smart line join |
Ctrl+Enter | Smart line split/智能分隔行 |
Shift + Enter | Start new line/开始新一行。光标所在行下空出一行,光标定位到新行位置 |
Ctrl + Shift + U | Toggle case for word at caret or selected block/对选中的代码进行大 / 小写轮流转换 |
Ctrl + Shift + ]/[ | Select till code block end/start(选择直到代码块结束/开始) |
Ctrl + Delete/Backspace | Delete to word end/start(删除到单词结束/开始) |
Ctrl + NumPad+/- | Expand/collapse code block(展开/折叠代码块) |
Ctrl + Shift+NumPad+ | Expand all(全部展开) |
Ctrl + Shift+NumPad- | Collapse all(全部折叠) |
Ctrl + F4 | Close active editor tab(关闭活动编辑器选项卡) |
Usage Search/使用搜索
快捷键 | 介绍 |
---|---|
Alt + F7/Ctrl + F7 | Find usages/Find usages in file(查找光标所在的方法 / 变量 / 类被调用的地方) |
Ctrl + Shift + F7 | Highlight usages in file(高亮显示所有该选中文本,按Esc高亮消失) |
Ctrl + Alt + F7 | Show usages(显示使用的地方。寻找被该类或是变量被调用的地方,用弹出框的方式找出来) |
Navigation/导航
快捷键 | 介绍 |
---|---|
Ctrl + N | Go to class(根据输入的 类名 查找类文件) |
Ctrl + Shift + N | Go to file(通过文件名定位 / 打开文件 / 目录,打开目录需要在输入的内容后面多加一个正斜杠) |
Ctrl + Alt + Shift + N | Go to symbol(转到符号) |
Alt + Right/Left | Go to next / previous editor tab(按右方向切换当前已打开的文件视图/按左方向切换当前已打开的文件视图) |
F12 | Go back to previous tool window(回到前一个工具窗口) |
Esc | Go to editor (from tool window)从工具窗口进入代码文件窗口 |
Shift + Esc | Hide active or last active window(隐藏当前 或 最后一个激活的工具窗口) |
Ctrl+Shift+F4 | Close active run messages/find /…tab(关闭活动运行消息/查找/…选项卡) |
Ctrl+G | Go to line(转到行) |
Ctrl+E | Recent files popup(可以显示最近编辑的文件列表) |
Ctrl+Alt + Left/Right | Navigate back/forward(退回到上一个操作的地方/前进到上一个操作的地方) |
Ctrl+Shift+Backspace | Navigate to last edit location(可以跳转到上次编辑的地方) |
Alt + F1 | Select current file or symbol in any view(显示当前文件选择目标弹出层,弹出层中有很多目标可以进行选择) |
Ctrl + B , Ctrl + Click | Go to declaration(进入光标所在的方法/变量的接口或是定义出,等效于 Ctrl + 左键单击) |
Ctrl + Alt + B | Go to implementation(s)在某个调用的方法名上使用会跳到具体的实现处,可以跳过接口 |
Ctrl + Shift + I | Open quick definition lookup(快速查看光标所在的方法 或 类的定义) |
Ctrl + Shift + B | Go to type declaration(跳转到类型声明处) |
Ctrl + U | Go to super-method super-class(前往当前光标所在的方法的父类的方法 / 接口定义) |
Alt + Up/Down | Go to previous/next method(当前光标跳转到当前文件的前一个方法名位置/当前光标跳转到当前文件的后一个方法名位置) |
Ctrl + ]/[ | Move to code block end/start(移动光标到当前所在代码的花括号结束位置/移动光标到当前所在代码的花括号开始位置) |
Ctrl + F12 | File structure popup(弹出当前文件结构层,可以在弹出的层上直接输入,进行筛选) |
Ctrl + H | Type hierarchy(显示当前类的层次结构) |
Ctrl + Shift + H | Method hierarchy(显示方法层次结构) |
Ctrl + Alt + H | Call hierarchy(调用层次) |
F2 / Shift + F2 | Next/previous highlighted error(跳转到上一个高亮错误 或 警告位置) |
F4 / Ctrl + Enter | Edit source View source(编辑源) |
Alt + Home | Show navigation bar(定位 / 显示到当前文件的 Navigation Bar) |
F11 | Toggle bookmark(添加书签) |
Ctrl + F11 | Toggle bookmark with mnemonic(选中文件 / 文件夹,使用助记符设定 / 取消书签) |
Ctrl + #[0-9] | Go to numbered bookmark(定位到对应数值的书签位置) |
Shift + F11 | Show bookmarks(弹出书签显示层) |
Search/Replace(搜索/替换)
快捷键 | 介绍 |
---|---|
Double Shift | Search everywhere(弹出 Search Everywhere 弹出层) |
Ctrl + F | Find(查找) |
F3 / Shift + F3 | Find next / Find previous(查找下一个/查找上一个) |
Ctrl + R | Replace(替换) |
Ctrl + Shift + F | Find in path(根据输入内容查找整个项目 或 指定目录内文件) |
Ctrl + Shift + R | Replace in path(根据输入内容替换对应内容,范围为整个项目 或 指定目录内文件) |
Live Templates/代码模板
快捷键 | 介绍 |
---|---|
Ctrl + Alt + J | Surround with Live Template(弹出模板选择窗口,讲选定的代码加入动态模板中) |
Ctrl + J | Insert Live Template(插入自定义动态代码模板) |
iter | Iteration according to Java SDK 1.5 style(根据Java SDK 1.5风格进行迭代) |
inst | Checkobjecttype with instanceof and downcast it(用instanceof检查objecttype并将其向下转换) |
itco | Iterate elements of java.util.Collection |
itit | Iterate elements of java.util.Iterator |
itli | Iterate elements of java.util.List |
psf | public static final |
thr | throw new |
Refactoring/重构
快捷键 | 介绍 |
---|---|
F5 | Copy |
F6 | Move |
Alt + Delete | Safe Delete |
Shift + F6 | Rename(重命名) |
Ctrl + F6 | Change Signature(更改签名) |
Ctrl + Alt + N | Inline(行内) |
Ctrl + Alt + M | Extract Method(提取方法) |
Ctrl + Alt + V | Extract Variable(提取变量) |
Ctrl + Alt + F | Extract Field(提取字段) |
Ctrl + Alt + C | Extract Constant(提取常量) |
Ctrl + Alt + P | Extract Parameter(提取参数) |
Debugging/调试
快捷键 | 介绍 |
---|---|
F8 | Step over(在 Debug 模式下,进入下一步,如果当前行断点是一个方法,则不进入当前方法体内) |
F7 | Step into(在 Debug 模式下,进入下一步,如果当前行断点是一个方法,则进入当前方法体内,如果该方法体还有方法,则不会进入该内嵌的方法中) |
Alt + F9 | Run to cursor(运行到光标处,你可以将光标定位到你需要查看的行,然后使用这个功能,代码会运行到光标处,不需要打断点) |
Alt + F8 | Evaluate expression(计算表达式的值) |
F9 | Resume program(恢复程序,比如,你在第3行和5行各自都打了断点,当前运行到第3行,按F9,则运行到下一个断点即第5行,再按F9,则运行完整个流程,因为后面已经没有断点了) |
Ctrl + F8 | Toggle breakpoint(在 Debug 模式下,设置光标当前行为断点,如果当前已经是断点则去掉断点) |
Ctrl + Shift + F8 | View breakpoints(查看设置的所有断点) |
Compile and Run/编译和运行
快捷键 | 介绍 |
---|---|
Ctrl + F9 | Make project (compile modifed and dependent)重新编译和引入依赖 |
Ctrl + Shift + F9 | Compile selected file, package or module(编译选中的文件 / 包 / 模块) |
Alt + Shift + F10/F9 | Select configuration and run/and debug(弹出 Run 的可选择菜单/弹出 Debug 的可选择菜单) |
Shift + F10/F9 | Run/Debug(运行/调试) |
Ctrl + Shift + F10 | Run context configuration from editor(从编辑器运行上下文配置) |
VCS/Local History(版本控制/本地历史)
快捷键 | 介绍 |
---|---|
Ctrl + K / Ctrl + T | Commit project to VCS/Update from VCS(版本控制提交项目/版本控制更新项目) |
Alt + Shift + C | View recent changes(查看最近操作项目的变化情况列表) |
Alt + ` | VCS Operations Popup(显示版本控制常用操作菜单弹出层) |
General/通用
快捷键 | 介绍 |
---|---|
Alt + #[0-9] | Open corresponding tool window(显示对应数值的选项卡,其中 1 是 Project 用得最多) |
Ctrl + S | Save all(全部保存) |
Ctrl + Alt + Y | Synchronize(同步、刷新) |
Ctrl + Shift + F12 | Toggle maximizing editor(编辑器最大化) |
Alt + Shift + F | Add to Favorites(添加到收藏夹) |
Alt + Shift + I | Inspect current file with current profile(查看项目当前文件) |
Ctrl + BackQuote (`) | Quick switch current scheme(快捷切换键,可以切换主题、视图模式、快捷键组合) |
Ctrl + Alt + S | Open Settings dialog(打开 IntelliJ IDEA 系统设置) |
Ctrl + Alt + Shift + S | Open Project Structure dialog(打开项目结构面板) |
Ctrl + Shift + A | Find Action(查找动作 / 设置) |
Ctrl + Tab | Switch between tabs and tool window(编辑窗口切换,如果在切换的过程又加按上delete,则是关闭对应选中的窗口) |
评论
匿名评论隐私政策