1. Plugins

    • IDE Features Trainer, newcomer’s guide
    • Presentation Assist
    • ideaVim, custom settings in ~/.ideavimrc
    • Key Promoter, display keyboard shortcuts for every action

    2. Actions & Shortcuts

    Keymap: Mac OSX 10.5+

    2.1 Quick Access

    • cmd + shift + a Find action and shortcuts
    • cmd + shift + o Open file, supports wildcard / camelcase
    • cmd + option + o Symbol lookup, supports filtering: <filename>.<symbol>
    • Search Everywhere
      • left / right History
      • tab Navigate
      • shift ( in Run Configuration ) Switch between Run and Debug
      • settings include / exclude search options
      • #plugins open plugin settings

    2.2 Editor

    • F2 Next high priority problem
    • cmd + F12 File structure popup, supports speed search
    • cmd + - / + Collapse / Expand
    • cmd + shift + - / + Collapse all / Expand all
    • cmd + y Show definition
    • control + j Show quick documation
    • cmd + shift + F12 Hide/Show all toolwindow
    • cmd + shift + v Show clipboard
    • cmd + shift + b Go to implementations

    2.3 Code Assistance

    • cmd + j Live template and do quick search (such as iter)
    • option + up Extend selection (context aware)
    • cmd + p View method signature
    • cmd + option + t Surround with, such as if(expr)
    • Move Line Up

    Code completion:

    • CamelCase prefixes in code completion: NPE for NullPointerException code completion suggestions, m.r suggests myVarible.read
    • control + shift + space: Type matching code completion (IDE analyzes the expected type of the whole expression and helps to find methods and variables that are applicable in the current context)
    • cmd + shift + enter Complete statements
    • invoke smart completion twice to see chained method calls
    • invoke basic completion twice to see completion for static methods: e.g. sort suggest Arrays.sort
    • postfix completion: var.if

    Refactor:

    • Extract variable / method
    • Pull methods up

    2.4 Activate ToolWindow

    • cmd + 1: Project
    • cmd + 2: Favorites
    • cmd + 9: Version Control
    • cmd + 4/5: Run / Debug
    • option + F1: Navigating between IDE components
    • cmd + F12: Terminal
    • cmd + shift + left / right: Resize ToolWindow

    3. Tips

    • Don’t use Tab, use Recent Files popups, supports speed search and deletion
      • cmd + e Recent files
      • cmd + shift + e Recent edited files
      • Preferences -> Editor -> General -> Editor Tabs -> Tab Appearance - Placement: None
    • Hide Navigation Bar, invoke with cmd + up
    • Enable Project - Settings - Autoscroll to Source
    • Assign shortcut for VCS - Git - Annotate
    • View Help - Productivity Guide
    • Option + Mouse selection for multi-cursor

    Local History

    支持对目录、文件查看变更历史,可以作为 VCS 误操作的一些补救措施,不要过度依赖。

    • Project View 右键 -> Local History
    • VCS -> Local History

    代码浏览

    当浏览一个大型工程时,涉及较多文件间跳转,一些有帮助的快捷键

    1. 窗口布局相关

    • 快速开/关 Project 视图:cmd + 1
    • 调整 Project 窗口宽度:cmd + shift + left/right
    • 快速开/关除编辑器外的其他 ToolWindow: cmd + shift + F12,有助于聚焦在代码浏览

    2. 文件浏览相关

    • 建议关闭 Tabs 模式,通过 Recent Files 快捷键来切换文件
    • 查看最近打开的文件:cmd + e,支持输入字符搜索,列表序是按文件打开时间倒排的
    • Project 视图选项里开启 Autoscroll from Source,目录会自动跟随定位到当前打开的文件
    • Project 视图也支持 Speed Search,即输入字符快速在列表中搜索匹配
    • 快速将窗口焦点切换到编辑器:escF4
    • Project 视图中左右键可快速打开关闭一个目录

    3. 快捷键搜索

    • 文件/类/符号检索
    • 全局字符串搜索,支持正则、文件名过滤等搜索条件 cmd + shift + f
    • 当前文件的符号检索 cmd + F12

    注:2018.3+ 版本后,Search Everywhere 搜索框,可通过 Tab 来切换搜索维度了。
    很好的设计,避免新人记忆快捷键,简化了搜索维度切换的操作。

    4. 代码跳转/展示

    • 代码折叠/展开:cmd + -/+
    • 全部代码折叠/展开:cmd + shift + -/+
    • 代码导航:
      • 查看实现 Go to Implementation cmd + shift + b
      • 查看调用 Find Usage option + F7
      • 查看定义 Quick Definition popup cmd + y
      • 查看文档 Quick Documentation popup F1shift + k
    • 添加书签/查看书签列表:F3shift + F3
    • 函数参数提示:cmd + p

    5. Java Develop 相关

    • BreakPoint 可以分组并命名
    • Copy Name (cmd + shift + c) / Copy reference (cmd + shift + option + c)

    ideaVim 配置

    IntelliJ 的 ideaVim 插件同样支持 vimrc 配置文件,位于 ~/.ideavimrc

    set hlsearch
    set incsearch
    set ignorecase
    set smartcase
    set showmode
    set history=100000
    nnoremap <Space>sc :nohlsearch<CR>
    nnoremap Y y$
    
    imap <C-n> <ESC>:action HippieCompletion<CR>a
    imap <C-p> <ESC>:action HippieBackwardCompletion<CR>a
    

    Using IDEA for document writing

    • Enable shell script idea (Using JetBrains Toolbox)
    • Enable LanguageTool plugin (Grazie plugin which is bundled) for spelling and grammar check
    • Disable all toolbar to avoid distraction: View Appearence - Toolbar / ToolWindow Bar / Status Bar / Navigation Bar
    • Configure Font: .AppleSystemUIFont 14px for both IDE Theme and Editor Font. (Switch Back to Menlo or JetBrains Mono for code). Note that IDEA’s Terminal share the same font with Editor

    • Add shortcuts for Markdown operation:

    • Cyclic Expand Word (Completion): control + enter
    • Config Markdown Style CSS: Load from URI (Using Markdown GitHub Style css)
    • Config Markdown Live Template for table

    References