当前位置: 首页 > news >正文

idea 常用快捷键

目录

  • 高效开发
    • 格式化代码
    • 选中代码
    • 智能提示
    • 基础编辑
  • 重构
  • 搜索替换
  • 搜索URL
  • 查看类信息
    • 路径
    • 脑图
    • 查看定义
    • 代码结构
  • 项目编译&构建&Debug&Run
    • Build Project
    • Debug&Run
    • 终止任务
  • 代码调试
  • 导航类
    • 查看设置
    • 退出&关闭
    • 最近编辑
    • 编辑器视觉
    • cursor代码
  • git
  • Maven
  • Bookmark
  • 小工具
  • 参考

高效开发

格式化代码

快捷键功能
Ctrl + Alt + O去除导入的已无用的 import(Optimize imports)
TabIndent
Shift + TabTab 逆操作(unindent selected lines)
Ctrl + Alt + I自动缩进代码(Auto-indent line(s))
Ctrl + Alt + L格式化选中的代码(Reformat code)
Ctrl + Alt + Shift + L定制化格式化代码
Enter换行
Ctrl + Enter换行 + 但光标不动(Smart line split)
Shift + Enter任意位置→换行(Start new line)
Ctrl + Shift + J删除当前行尾回车,使下面一行挪到当前行(Smart line join)

选中代码

快捷键功能
Shift + Home / End选中光标 到当前文件行头位置 / 尾位置
Ctrl + Shift + [ / ]选中光标 到方法头 / 方法尾 (Select till code block start / end)
Ctrl + W智能加选代码(Select successively increasing code blocks)
Shift + Ctrl + WCtrl + W 相逆动作(Decrease current selection to previous state)
Alt + Shift + 左键多处插入光标
Alt + 左键拖动竖块选择代码

智能提示

快捷键功能
Ctrl + JInsert Live Template
Ctrl + Alt + JSurround with Live Template
Alt + R生成代码伪数据…( Randomness插件
Alt + InsertGenerate code… (Getters, Setters, Constructors, hashCode/equals, toString)
类类型上 Alt + Enter一键调用对象所有setter方法(GenerateAllSetter插件
Ctrl + Shift + Space智能提示代码(Smart code completion)
Ctrl + Alt + Space智能提示代码(Basic code completion)
Alt + EnterShow intention actions and quick-fixes
Ctrl + Shift + Enter智能结尾,帮助输入;等(Complete statement)

基础编辑

快捷键功能
Ctrl + Shift + U大小写切换(Toggle case for word at caret or selected block)
Alt + Shift + U命名切换(CamelCase插件
Ctrl + X / Shift + Delete剪切(Cut current line or selected block to clipboard)
Ctrl + C / Ctrl + Insert复制(Copy current line or selected block to clipboard)
Ctrl + V / Shift + Insert粘贴(Paste from clipboard)
Ctrl + Shift + V选择 复制历史的内容 粘贴(Paste from recent buers…)
Ctrl + D复制选中的内容(Duplicate current line or selected block)
Ctrl + Shift + ↑/↓把选中行 向 上/下移动
Ctrl + Alt + Shift + ↑/↓复制选中行 并 插入 上/下 面( Duplicate Lines插件
Ctrl + Y删除行(Delete line at caret)
Ctrl + Delete / Backspace删除单词光标 后/前 部分(Delete to word end / start)
Alt + Delete安全删除,有使用的地方会提示(Safe Delete)
Ctrl + Z撤销
Ctrl + Shift + Z取消撤销
Ctrl + /注释/取消注释 行代码(Comment / uncomment with line comment)
Ctrl + Shift + /注释/取消注释 快代码(Comment / uncomment with block comment)
Ctrl + S保存(Save all)

重构

快捷键功能
Ctrl + Alt + Shift + T重构总菜单(Reactor this)
Ctrl + Alt + CExtract Constant(抽取常量)
Ctrl + Alt + FExtract Field(抽取属性)
Ctrl + Alt + PExtract Parameter(抽取方法参数)
Ctrl + Alt + VExtract Variable(抽取局部变量)
Ctrl + Alt + MExtract Method(抽取方法)
Ctrl + Alt + N抽取的方法融入调用处(Inline)
Ctrl + Alt + TSurroundwith…(if…else,try…catch, for, synchronized, etc.)
Ctrl + OOverride methods
Ctrl + IImplement methods
Shift + F6Rename
Ctrl + F6Change Signature
F5Copy class
F6Copy static Members

搜索替换

快捷键功能
Alt + 3打开Find窗口
Shift + ShiftSearch everywhere
Ctrl + NShift + Shift子选项 → Go to class
Ctrl + Shift + NShift + Shift子选项 → Go to file
Ctrl + Alt + Shift + NShift + Shift子选项 → Go to symbol
Ctrl + Shift + AShift + Shift子选项 → Find Action
Ctrl + F在当前文件 查找文本内容(Find)
Ctrl + Shift + F在路径下所有文件 查找文本内容(Find in path)
Ctrl + R在当前文件里 替换文本内容(Replace)
Ctrl + Shift + R在路径下所有文件 替换文本内容(Replace in path)
F3相当于 Ctrl + F 然后点 下一个(Find next)
Shift + F3相当于 Ctrl + F 然后点 下一个(Find previous)
Ctrl + F7当前文件中某个符号(如类名、方法、变量)的所有使用位置(Find usages in file)
Ctrl + Shift + F7还没体会到其精髓(Highlight usages in file)
Alt + J相当于Ctrl + F7 + 加选功能
Shift + Alt + JAlt + J 逆操作
Ctrl + Alt + Shift + J相当于Ctrl + F7 + 全选功能
Ctrl + '(单引号)相当于 Ctrl + Alt + Shift + J,然后全部上色(随机)( MultiHighlight 插件
Ctrl + Shift + '(单引号)相当于 Ctrl + Alt + Shift + J,然后全部上色(可选择颜色)( MultiHighlight 插件
CtrlAlt + Shift + '(单引号)全部褪色( MultiHighlight 插件
F2跳转到 下一个 高亮错误 / 警告位置(next highlighted error)
Shift + F2F2 逆操作(previous highlighted error)
F7git show diff 里用他查下一个不同,嗷嗷好用(next different)
Shift + F7F7 逆操作(previous different)
Ctrl + Shift + T类和UT测试类间跳转
Ctrl + Alt + HomeReleated Symbol(还没体会到其精髓)

搜索URL

快捷键功能
Ctrl + Shift + \go to URL Mapping
Ctrl + \ RestfulToolkit插件

查看类信息

路径

快捷键功能
Ctrl + Shift + C右键→Copy path / 复制当前文件绝对路径
Ctrl + Alt + Shift + CCopy Reference
Ctrl + Alt + F12 / Alt + F1选C右键→Open in→Explorer / 打开本地目录

脑图

快捷键功能
Ctrl + Alt + UUML (popup)
Ctrl + Alt + Shift + UUML(新tab页展示)
Ctrl + Alt + Shift + DUML(仅展示有变动的文件)(Show Local Changes as UML)

查看定义

快捷键功能
Ctrl + mouse over code查看其定义
Ctrl + QQuick documentation lookup(查看类签名 + 方法文档说明)
Ctrl + PParameter info (看方法参数)
Ctrl + F1Error Description(看异常提示信息)
Shift + F1External Doc(看外部文档,如果有外部文档连接)

代码结构

快捷键功能
Alt + 7File structure
Ctrl + F12File structure popup
Alt + F7Find usages(查找使用的地方)
Ctrl + Alt + F7Show usages (popup)(查找使用的地方)
Ctrl + Alt + Shift + F7Find usages Setting(查找使用的地方)
Ctrl + HType hierarchy (看类继承关系)
Ctrl + Shift + HMethod hierarchy(看方法 继承/实现 关系)
Ctrl + Alt + HCall hierarchy(看方法调用链)
Ctrl + UGo to super-method / super-class(看父方法,接口的抽象方法)
Ctrl + Alt + B / Ctrl + Alt + ClickGo to implementation(s)(看抽象方法实现方法)
Ctrl + B / Ctrl + Click / F4Go to declaration(看方法,变量定义)
Ctrl + Shift + BGo to type declaration(看 对象的类的定义)

项目编译&构建&Debug&Run

Build Project

快捷键功能
Ctrl + F9Make project (compile modifed and dependent)
Ctrl + Shift + F9Compile selected file, package or module

Debug&Run

快捷键功能
Alt + Shift + F9 / F9Select configuration and debug
Alt + Shift + F10Select configuration and run
Shift + F9Debug(等效工具栏的Debug按钮)
Shift + F10Run(等效工具栏的Run按钮)
Ctrl + Shift + F10Run context configuration from editor

终止任务

快捷键功能
Ctrl + F2Stop
Ctrl + Shift + F2Stop Backend Progress
Ctrl + F5Rerun

代码调试

快捷键功能
Alt + 4打开Run窗口
Alt + 5打开Debug窗口
F7Step into(进入方法)
Shift + F7Smart Step into(弹出多个可进入的方法)
Alt + Shift + F7Force Step into(一般进入底层代码时使用)
Shift + F8Step out(跳出方法)
F8Step over(下一步)
Alt + Shift + F8Force Step over(强制下一步,貌似我还没用过)
Alt + F10Show Execution point(快速回到debug锚点)
F9Resume program(恢复程序运行、直到下个断点拦截,视觉像跳到下个断点)
Alt + F9Run to cursor(调试利器,鼠标放哪里就Debug到哪,极其好用)
Ctrl + Alt + F9Force Run to cursor(貌似我还没用过)
Alt + F8Evaluate expression(适合多次计算的场景,弹窗一直在)
Ctrl + Alt + F8Quick Evaluate expression(适合一次计算的场景,弹窗计算一次后就关闭)
Ctrl + Shift + F8View breakpoints(查看所有断点,笔者一般用在取消全部断点时使用)
Ctrl + Alt + F6Show Coverage Data(查看UT覆盖率)

导航类

查看设置

快捷键功能
Ctrl + Alt + Shift + /Maintenance(到Idea管理后台,开发时很少用)
Ctrl + Alt + SOpen Settings dialog(打开设置)
Ctrl + Alt + Shift + SOpen Project Structure dialog(打开项目结构)
F12Go back to previous tool window
Alt + F1呼出集成的快捷菜单

退出&关闭

快捷键功能
EscGo to editor (from tool window)
Shift + EscHide active or last active window
Ctrl + Shift + F4Close active run / messages / find / … tab(退出,idea点更快)
Ctrl + F4Close active editor tab(关tag,idea点更快)
Shift + 左键单击关闭当前打开的文件
Alt + F4Close IDEA(关idea,idea点更快)

最近编辑

快捷键功能
Ctrl + ERecent files popup(浏览最近打开的文件)
Ctrl + Shift + E打开最近编辑(没觉得有啥用)
Alt + Shift + CView recent changes(没觉得有啥用)
Ctrl + TabSwitch between tabs and tool window(没觉得有啥用)

编辑器视觉

快捷键功能
Ctrl + NumPad + Expand code block(展开折叠的方法)
Ctrl + NumPad -Collapse code block(折叠单个方法)
Ctrl + Shift + NumPad + Expand all(展开全部折叠的方法)
Ctrl + Shift + NumPad-Collapse all(折叠全部方法)
Ctrl + Shift + F12Toggle maximizing editor(最大化编辑器)
Shift + F4 / Split Right文件使用新Windows窗口打开,旧窗口保留(多用于两个文件对比时,或放一起截图时)
Shift + 滚轮前后滚动当前文件的横向滚动轴滚动
Ctrl + 滚轮前后滚动放大屏幕字体

cursor代码

快捷键功能
Alt + 1打开Project窗口(窗口不显示笔者视觉及其不舒服,故这个对笔者很重要)
Alt + 6打开Problem窗口
Alt + 8打开Services窗口
Ctrl + GGo to line(到指定行数)
Ctrl + ] / [Move to code block end / start
Alt + ↑ / ↓Go to previous / next method
Alt + ← / →Go to next / previous editor tab
Ctrl + Alt + ← / →Navigate back / forward(跳到上次 / 下次 查看的位置)
Ctrl + Shift + BackspaceNavigate to last edit location(跳到最后编辑的位置)

git

快捷键功能
Alt + 9打开Git窗口
Alt + F12打开Terminal窗口(多用于Terminal窗口执行git命令)
Alt + BackQuoteVCS Operations Popup(相当于很多git操作入口)
Ctrl + Shift + BackQuoteBranch(查看分支列表)
Ctrl + TUpdate from VCS(一般先fetch ,然后Ctrl+T更新代码)
Alt + CShow Diff (笔者自定义)
Ctrl + Alt + ZRollback
Ctrl + Alt + AAdd
Alt + 0 / Ctrl + K打开Commit窗口 / Commit project to VCS
Ctrl + Shift + KPush

Maven

快捷键功能
Ctrl + CtrlRun Anything(可以执行mvn 命令,还有其他很多命令)
Ctrl + Alt + Shift + RRun Maven Goal on Root Module

Bookmark

快捷键功能
Alt + 2打开bookmarks窗口(可多次查看,窗口不会关闭)
Shift + F11Show bookmarks(快览,点某个标签后窗口会关闭)
Ctrl + Shift + [0-9]mark numbered bookmark(Ctrl + Shift + 1标记,Ctrl + 1快速跳转,和飞雷神一样)
Ctrl + [0-9]Go to numbered bookmark(Ctrl + Shift + 1标记,Ctrl + 1快速跳转,和飞雷神一样)
F11 / Ctrl + 左键Toggle bookmark(快速打标签)
Ctrl + F11Toggle bookmark with mnemonic(和Ctrl + Shift + 1比少了跳转,和F11比多个名称,有点鸡肋)

小工具

快捷键功能
Ctrl + Shift + Y翻译 ( Translate插件
Ctrl + Shift + SSonarLint 代码分析( SonarLint插件
Ctrl + Shift + I智谱AI(CodegeeX插件
Ctrl + Shift + P阿里(通意灵码插件
Ctrl + Shift + OChatGPT( Bito插件
字节( MarsCode/Trae AI: Coding Assistant插件

参考

[实践总结] idea 快捷键
IDEA快捷键200+分类汇总
IDEA 常用快捷键大全(建议收藏)

http://www.dtcms.com/a/271159.html

相关文章:

  • Mysql中的日志-undo/redo/binlog详解
  • 学习open62541 --- [79] 在docker中运行open62541工程
  • pytorch chunk 切块
  • 【C++】容器适配器 + stack/queue/deque详解
  • Java基础,反射破坏封装性 - 单例模式的崩塌
  • 掌握PDF转CAD技巧,提升工程设计效率
  • 第四节 chatPDF
  • 机器视觉之工业相机讲解
  • unity animtor播放动画的指定位置
  • spring boot使用mybatis-plus实现分页功能
  • C++学习笔记三
  • MATLAB基于voronoi生成三维圆柱形
  • Token 和 Embedding的关系
  • 基于AOP+Redis的简易滑动窗口限流
  • C#基础篇(10)集合类之列表
  • 列表页智能解析算法:大规模数据采集的核心引擎
  • 2024-2025-2 山东大学《编译原理与技术》期末(回忆版)
  • 【ARM嵌入式汇编基础】- 操作系统基础(二)
  • JSP数据交互
  • php绘图添加水印,文字使用imagick库的操作
  • Docker 高级管理-容器通信技术与数据持久化
  • C语言结构体对齐
  • SpringCloud系列 - xxl-job 分布式任务调度 (七)
  • 链表和数组和列表的区别
  • 力扣网编程150题:加油站(贪心解法)
  • Origin将Y偏移图升级为双Y轴3D瀑布图
  • SAP-ABAP:SAP中‘SELECT...WHERE...IN’语句IN的用法详解
  • 想要抢早期筹码?FourMeme专区批量交易教学
  • Cadence模块复用
  • SQL 视图与事务知识点详解及练习题