【IDEA保姆级教程】快捷键

IDEA快捷键

【IDEA保姆级教程】快捷键_第1张图片

所有的快捷键都可以在IDEA的Help菜单-》Keymap Reference中找到。

常用的我都通过*标记出来了。

编辑类【Editing】

  • 代码补全、提示*:Ctrl + Space
    Basic code completion (the name of any class, method or variable)

    任何类的名称、方法、变量都可以提示。

    根据使用习惯我会修改为:Alt + /

    修改方法:

    1、从File–》Settings–》KeyMap(快捷键Ctrl+Alt+S)进入快捷键设置界面。
    IDEA中默认的代码自动提示快捷键是Basic Ctrl+空格(可以再搜索框中输入basic快速查找),这个和安装的中文输入法切换快捷键冲突,所以需要修改。

    2、需要将Basic的快捷键修改为Alt+/,但Alt+/被Cyclic Expand Word占用,所以先修改Cyclic Expand Word的快捷键,右键Remove Alt+斜杠。

    3、右键Add Keyboard Shutcut,然后在键盘上按下Alt+空格,点击ok即完成修改。

  • 在列出的可选项中只显示出你所输入的关键字最相关的信息*: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 + hover
    Brief Info

    hover 就是鼠标停留

  • Show descriptions of error or warning at caret:Ctrl + F1

  • 生成代码*:Alt + Insert
    Generate code… (Getters, Setters, Constructors, hashCode/equals, toString)

  • 重写方法*:Ctrl + o
    Override methods

  • 实现方法*:Ctrl + i
    Implement methods

  • 在外面围绕*:Ctrl + Alt + t
    Surround with…(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

    会和QQ的锁定QQ热键冲突,建议把QQ的热键关掉。

  • 优化导入*:Ctrl + Alt + o
    Optimize imports

    会和QQ的屏幕识图热键冲突,建议把QQ的热键关掉。

  • 自动缩进: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 buffers…

  • 复制当前行*: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 + + / -
    Expand/collapse code block

  • 展开所有代码段:Ctrl + Shift + +
    Expand all

  • 收缩所有代码段:Ctrl + Shift + -
    Collapse all

  • 关闭当前页:Ctrl + F4 / Shift + 鼠标左键
    Close active editor tab

使用情况【Usage Search】

  • 查找使用(全局)/查找使用(当前文件):Alt + F7 / Ctrl + F7
    Find usages/Find usages in file
  • 突出显示文件中的使用:Ctrl + Shift + F7
    Highlight usages in file
  • 使用情况列表:Ctrl + Alt + F7
    Show usages

导航【Navigation】

  • 打开类查询框*:Ctrl + n
    Go to class

  • 打开文件查询框*:Ctrl + Shift + n
    Go to file

  • 打开符号查询框*:Ctrl + Alt + Shift + n
    Go to symbol

    如果你依稀记得某个方法名字几个字母,想在IDEA里面找出来,使用symbol来查找即可。

  • 转到下一个/上一个选项卡:Alt + 右箭头/左箭头
    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 + 左箭头/右箭头
    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 + Alt + b
    Go to implementation(s)

  • 打开一个面板里面快速查看定义:Ctrl + Shift + i
    Open quick definition lookup

  • 打开变量类型所对应的代码:Ctrl + Shift + b
    Go to type declaration

    只对变量有用,个人感觉这个没啥用,真要看变量的类型我们会直接用Ctrl+鼠标左键点击变量前面的类来看。

  • 打开方法的父类* :Ctrl + u
    Go to super-method / super-class

  • 跳转到上个/下个方法:Alt + 上键 / 下键
    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

  • 将光标处的代码添加书签或从书签移除:F11
    Toggle bookmark

    按下后会在代码行数前面打个√

  • 将光标处的代码添加到书签带快捷键或从书签移除:Ctrl + F11
    Toggle bookmark with mnemonic

  • 跳转到快捷书签处:Ctrl + [0-9]
    Go to numbered bookmark

  • 显示书签列表:Shift + F11
    Show bookmarks

搜索替换【Search/Replace】

  • 当前页面查找*: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

重构【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
  • 进入子方法*:F7
    Step into
  • 选择需要跳转到的方法*:Shift + F7
    Smart step into
  • 跳出到上级*:Shift + F8
    Step out
  • 让代码运行到当前光标所在处*:Alt + F9
    Run to cursor
  • 打开一个表达式面板,然后进行进一步的计算*:Alt + F8
    Evaluate expression
  • 结束调试*:F9
    Resume program
  • 在光标处,添加或者删除断点。Ctrl + F8
    Toggle breakpoint
  • 打开当前断点的面板,可以进行条件过滤*: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
  • 打开一个已经配置的运行列表来调试运行: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 + BackQuote (`)
    VCS Operations Popup

全局【General】

  • 快速打开工具窗口*:Alt + #[0-9]
    Open corresponding tool window
    1:Project
    2:Favorites 收藏夹
    3:Find
    4:Application
    6:TODO
    7:Structure 结构
    8:Services
    9:Subversion
  • 保存*: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
  • 打开项目结构窗口*:Ctrl + Alt + Shift + S
    Open Project Structure dialog
  • 查找动作:Ctrl + Shift + A
    Find Action
  • 在选项卡和工具窗口之间切换:Ctrl + Tab
    Switch between tabs and tool window

其他文章

IntelliJ IDEA 快捷键说明大全(中英对照、带图示详解)

你可能感兴趣的:(intellij,idea)