Idea Intellij 常用快捷键
Navigation
- Ctrl-N — Goes to class, can go by first letter / toggle by project files
- Can use first letter of class name, i.e. FooBarFactory as FBF
- Can use pattern / regex to filter
- CN:40, go to line 40 in file
- Ctrl-Shift-N — Goes to class / toggle by project files
- Can go to folder by doing ‘/baz_folder'
- Ctrl-Shift-Alt-N — Any symbol
- Can filter by namespace, i.e. FBF.getFoo
- Alt-1 — Project Structure (Folders), can use keyboard to navigate / find by word
- Double-press Shift — Search everywhere
- Alt-7 — Project Structure sidebar (Symbol based)
- Ctrl-F12 — Project Structure popup
- Ctrl-E — Recent files
- Ctrl-Shift-E — Recently edited
- Ctrl-Tab — Quick switch
- Alt-Home — Jump to navigation bar
- Navigate with keys
- Use new file shortcut (Ctrl-N) to popup new file dialogue within dir
- Ctrl-B — goto definition
- Ctrl-Shift-I — Quick definition popup
- Ctrl-P — Parameter info
- Ctrl-U — Super definition
- Ctrl-Alt-B — Go to implementations
- Ctrl-Alt-Left / Ctrl-Alt-Right — navigate file history
- Ctrl-Shift-F7 — highlight usages in file
- Can use on return / throw
- Ctrl-Shift-F12 — hide / restore all windows
- Ctrl-Shift-P — Presentation mode
- Can search in settings
- Shift-F4 — open current file in new window
- Ctrl-Shift-Left / Ctrl-Shift-Right resize window you’re in
Editing code
- Ctrl-. — Fold section
- Ctrl-W — Expand section @ caret, (expands via word essentially)
- Ctrl-Shift-W — Reduces section @ caret
- Ctrl-Shift-Enter — Complete current statement
- Adds semicolon, blocks, etc
- Ctrl-D — Duplicate
- Ctrl-Shift-V — Clipboard history
- Alt-Shift-Click / Double Click Ctrl Up / Down — create new cursor
- Alt-J — Select next occurrence
- Alt-Shift-J — Select all occurrences
- Alt-Shift-Up / Down — Move selection
- Ctrl-Alt-L — reformat code
- Will format based on code style
- Use / Create Templates
- Ctrl-Space — Basic completion (text based)
- Ctrl-Shift-Space — Smart completion (i.e. show things you can instantiate at a given time)
- Alt-Enter — Intention popup
- Shift-Tab — On type , can switch to superclass, will automatically select that after ??? times
- Postfix completion — foo.notnull expands to a wrapped if, defaults include null, notnull, throws
Code Generation
- Alt-N — generators (toString, constructor, etc)
- toString + tab
- table#something — expand html
- ul>li*10 — 10 list elements
- F2 / Shift-F2 — next highlighted error
- Ctrl-Shift-Alt-T — Refactor menu
- Specialized refactoring is more context sensitive
Misc
- Teaches functional stuff in Java 8
- Questionable naming inspector
- Ctrl-Shift-S — structural search and replace
- Holy god this is complicated
- Ctrl-Shift-A — Search for shortcut
- Ctrl-K — commit
- Can create quick lists
- Ctrl-` — Quick switch keymap
- Can activate NPM require support
- Productivity guide from Help
参考
https://www.reddit.com/r/programming/comments/36zj6q/intellij_idea_42_tips_and_tricks_in_45_minutes/