阅读更多
1 Shortcuts
1.1 Refactor
HotKey Name: Refactor This
HotKey In Mac: ⌃T
HotKey In Windows: Ctrl+Alt+Shift+T
1.2 Gode Generator
1.2.1 Template
HotKey Name: Insert Live Template...
HotKey In Mac: ⌘J
HotKey In Windows: Ctrl+J
常用的几个模板
- 生成main函数:
psvm+Tab - 生成for循环模板:
fori+Tab - 生成System.out.println()语句:
sout+Tab
1.2.2 Generator
HotKey Name: Generate...
HotKey In Mac: ⌘N
HotKey In Windows: Alt+Insert
1.3 Edit
1.3.1 Extend Selection
HotKey Name: Extend Selection
HotKey In Mac: ⌥↑
HotKey In Windows: Ctrl+W
1.3.2 Shrink Selection
HotKey Name: Shrink Selection
HotKey In Mac: ⌥↓
HotKey In Windows: Ctrl+Shitf+W
1.3.3 Move Caret to Previous Word
HotKey Name: Move Caret to Previous Word
HotKey In Mac: ⌥←、⌥⇧←
HotKey In Windows: Ctrl+向左箭头、Ctrl+Shift+向左箭头
1.3.4 Move Caret to Next Word
HotKey Name: Move Caret to Next Word
HotKey In Mac: ⌥→、⌥⇧→
HotKey In Windows: Ctrl+向右箭头、Ctrl+Shift+向右箭头
1.3.5 Move Caret to Code Block Start
HotKey Name: Move Caret to Code Block Start
HotKey In Mac: ⌥⌘[、⌥⇧⌘[
HotKey In Windows: Ctrl+左方括号、Ctrl+Shift+左方括号
1.3.6 Move Caret to Code Block End
HotKey Name: Move Caret to Code Block End
HotKey In Mac: ⌥⌘]、⌥⇧⌘]
HotKey In Windows: Ctrl+右方括号、Ctrl+Shift+右方括号
1.3.7 Copilot
1.3.7.1 Apply Completions to Editor
HotKey Name: Apply Completions to Editor
1.3.8 Appearance
1.3.8.1 Inlay Hints
Path: Settings -> Editor -> Inlay Hints
Items:
- Inheritors
- Related problems
- Usages
- Code author
1.4 Navigate
1.4.1 Open Class
HotKey Name: Class...
HotKey In Mac: ⌘O
HotKey In Windows: Ctrl+N
1.4.2 Search
HotKey Name: Search Everywhere
HotKey In Mac: ⇧⇧
HotKey In Windows: Double Shift
1.4.3 Hierarchy
HotKey Name: Type Hierarchy
HotKey In Mac: ⌃H
HotKey In Windows: Ctrl+H
1.4.4 Declaration
HotKey Name: Declaration
HotKey In Mac: ⌘B、⌘Click
HotKey In Windows: Ctrl+B、Ctrl+Click
1.4.5 Implementation
HotKey Name: Implementation(s)
HotKey In Mac: ⌥⌘B、⌥⌘Click
HotKey In Windows: Ctrl+Alt+B、Ctrl+Alt+Click
1.4.6 Structure
HotKey Name: File Structure
HotKey In Mac: ⌘F12
HotKey In Windows: Ctrl+F12
1.4.7 Reference
HotKey Name: Find Usages
HotKey In Mac: ⌥F7
HotKey In Windows: Alt+F7
1.4.8 Content Search
HotKey Name: Find...、Find in Path...
HotKey In Mac: ⌘F、⇧⌘F
HotKey In Windows: Ctrl+F、Ctrl+Shift+F
1.4.9 Move in Results
HotKey Name: Find Previous / Move to Previous Occurrence
HotKey In Mac: ⌘G、⇧⌘G
HotKey In Windows: F3/Ctrl+L、Shift+F3/Ctrl+Shift+L
1.4.10 Find Action
HotKey Name: Find Action...
HotKey In Mac: ⇧⌘A
HotKey In Windows: Ctrl+Shift+A
1.4.11 Switch Tab
HotKey Name: Switcher
HotKey In Mac: ⌃Tab
HotKey In Windows: Ctrl+Tab
1.4.12 Recent Files
HotKey Name: Recent Files
HotKey In Mac: ⌘E
HotKey In Windows: Ctrl+E
1.4.13 Recent Changed Files
HotKey Name: Recent Changed Files
HotKey In Mac: ⇧⌘E
HotKey In Windows: Ctrl+Shift+E
1.4.14 Scroll Page
HotKey Name: Scroll to Top、Scroll to Bottom
HotKey In Mac: Undefined
HotKey In Windows: Undefined
1.5 Format
1.5.1 Code
HotKey Name: Reformat Code
HotKey In Mac: ⌥⌘L
HotKey In Windows: Ctrl+Alt+L
1.5.2 Import
HotKey Name: Optimize Imports
HotKey In Mac: ⌃⌥O
HotKey In Windows: Ctrl+Alt+O
1.5.3 Google Style
intellij-java-google-style.xml
1.5.4 Customized Stype
如何导入自定义格式化schema:Perference -> Editor -> Code Style
1 | <code_scheme name="starrocks" version="173"> |
1.5.5 Util
格式化工具的路径:<安装目录>/bin/format.sh
1.6 Reference
2 Intellij-IDEA
2.1 Color
- 打开Preference
- 搜索
Identifier under caret,如下图所示:
2.2 Serialize Field
PreferenceEditorInspections右边列表选择JavaSerialization issuesJava | Serialization issues | Serializable class without 'serialVersionUID'
2.3 Customized Information Of Class Comment
PreferenceEditorFile and Code TemplatesincludesFile Header
1 | /** |
2.4 wrong tag ‘date’
alt + enter -> add to custom tags
2.5 Console Color
安装插件grop console
2.6 Highlight Selection
PreferenceEditorColor SchemeGeneral- 右侧
CodeIdentifier under caretIdentifier under caret (write)
2.7 Debug ‘Debugger’ missing
restore layout
2.8 Plugin
Maven HelperLombokIdeaVimGithub Copilot
2.9 Compile OOM
How can I give the Intellij compiler more heap space?
For ${InstallPath}/bin/idea.vmoptions:
1 | -Xms128m |
Config path: Preferences -> Build, Execution, Deployment -> Compiler -> Shared build process heap size
- Compiler runs in a separate JVM by default so IDEA heap settings that you set in idea.vmoptions have no effect on the compiler.
2.10 Download JDK
Config path: Project Structure -> Platform Settings -> SDKs -> + -> Download JDK...
If you want to install jdk into /Library/Java/JavaVirtualMachines, you need to start IDEA as root.
cd /Applications/IntelliJ\ IDEA\ CE.app/Contents/MacOSsudo ./idea
2.11 Code Analyze
Code->Analyze Code->Run Inspection by Name
2.11.1 How to reset inspections (If press ignore xxx by mistake)
Settings->Editor->Inspections-> ⚙️ ->Restore Defaults
2.12 Reference
3 CLion
3.1 Plugin
thrift
4 IdeaVim
- 配置文件路径:
~/.ideavimrc - 查看所有的
action::actionlist - 目前不支持vim插件管理器,例如
Plug等
为了保持vim中的按键习惯,以下是~/.ideavimrc的内容
Copilot:触发补全的action是copilot.applyInlays,这个没法在~/.ideavimrc中进行映射的配置,因为在插入模式下,无法调用action,且如果使用<esc>或者<c-o>,那么Copilot的提示会消失,再触发action也没用
1 | " embedded vim-surround |
5 Assorted
- 开启长按表示重复
defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false
- Writing classes when compiling is suddenly very, very slow
- Theme
Atom One DarkGruvboxSolarized
