intellij IDEA 常用配置

在之前的 intellij IDEA 文章当中写了太多了内容了,在这篇文章当中我将会一一整理好 intellij IDEA 相关的内容和配置项,方便各位进行参考,在下面的文章内容当中我会把 intellij IDEA 简称都统一叫 IDEA 🐤

配置字体

点击 IDEA 左上角的 FileSettings 然后在弹出的窗口当中选择 Editor 在下拉列表当中选择 Font 配置内容如下图详解

如果你使用了主题,想要修改字体样式的话,就要找到主题的字体设置那一项了如下图

如果是老版本的 IDEA 需要把如下图的按钮给勾上,才可以看到此选项,如下图

2021年6月11日14:41:26 在这一天,我又发现了一款比较好的字体个人也比较喜欢,那么一起来看看吧

这个字体需要安装,安装好了重启 IDEA 即可看到这款代码字体个人没有用,只是 推荐一下 其实只需要给电脑安装就好了,不需要再去 IDEA 当中设置代码字体为 Monaco

<code_scheme name="Alibaba-CodeStyle" version="173">
    <option name="INSERT_INNER_CLASS_IMPORTS" value="true"/>
    <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
    <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
    <option name="IMPORT_LAYOUT_TABLE">
        <value>
            <package name="java" withSubpackages="true" static="false"/>
            <emptyLine/>
            <package name="javax" withSubpackages="true" static="false"/>
            <emptyLine/>
            <package name="com.alibaba" withSubpackages="true" static="false"/>
            <emptyLine/>
            <package name="" withSubpackages="true" static="false"/>
            <emptyLine/>
            <package name="" withSubpackages="true" static="true"/>
        </value>
    </option>
    <option name="FORMATTER_TAGS_ENABLED" value="true"/>
    <option name="WRAP_COMMENTS" value="true"/>
    <JavaCodeStyleSettings>
        <option name="ANNOTATION_PARAMETER_WRAP" value="1"/>
        <option name="INSERT_INNER_CLASS_IMPORTS" value="true"/>
        <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
        <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
        <option name="IMPORT_LAYOUT_TABLE">
            <value>
                <package name="java" withSubpackages="true" static="false"/>
                <emptyLine/>
                <package name="javax" withSubpackages="true" static="false"/>
                <emptyLine/>
                <package name="com.alibaba" withSubpackages="true" static="false"/>
                <emptyLine/>
                <package name="" withSubpackages="true" static="false"/>
                <emptyLine/>
                <package name="" withSubpackages="true" static="true"/>
            </value>
        </option>
        <option name="JD_ALIGN_PARAM_COMMENTS" value="false"/>
        <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false"/>
        <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true"/>
        <option name="JD_PRESERVE_LINE_FEEDS" value="true"/>
    </JavaCodeStyleSettings>
    <MarkdownNavigatorCodeStyleSettings>
        <option name="RIGHT_MARGIN" value="72"/>
    </MarkdownNavigatorCodeStyleSettings>
    <MySQLCodeStyleSettings version="5">
        <option name="USE_GENERAL_STYLE" value="false"/>
        <option name="KEYWORD_CASE" value="1"/>
        <option name="TYPE_CASE" value="1"/>
        <option name="CUSTOM_TYPE_CASE" value="1"/>
    </MySQLCodeStyleSettings>
    <SqlCodeStyleSettings version="5">
        <option name="KEYWORD_CASE" value="1"/>
        <option name="CUSTOM_TYPE_CASE" value="3"/>
        <option name="QUERY_SECTION_1ST_WORD_ALIGN" value="0"/>
        <option name="QUERY_IN_ONE_STRING" value="0"/>
        <option name="INSERT_TABLE_EL_LINE" value="0"/>
        <option name="INSERT_VALUES_EL_LINE" value="0"/>
        <option name="ORDER_EL_WRAP" value="0"/>
        <option name="TABLE_OPENING" value="0"/>
        <option name="TABLE_CONTENT" value="2"/>
        <option name="ROUTINE_ARG_WRAP" value="0"/>
        <option name="EXPR_CASE_THEN_ALIGN" value="true"/>
        <option name="INDEX_NAME_TEMPLATE" value="{unique?uk:idx}_{table}_{columns}"/>
        <option name="PRIMARY_KEY_NAME_TEMPLATE" value="pk_{table}"/>
        <option name="FOREIGN_KEY_NAME_TEMPLATE" value="fk_{table}_{ref_table}_{ref_columns}"/>
    </SqlCodeStyleSettings>
    <codeStyleSettings language="DB2">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="Derby">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="H2">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="HSQLDB">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="JAVA">
        <option name="RIGHT_MARGIN" value="120"/>
        <option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false"/>
        <option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false"/>
        <option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
        <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
        <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
        <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
        <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
        <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
        <option name="SPACE_AFTER_TYPE_CAST" value="false"/>
        <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
        <option name="CALL_PARAMETERS_WRAP" value="1"/>
        <option name="PREFER_PARAMETERS_WRAP" value="true"/>
        <option name="METHOD_PARAMETERS_WRAP" value="1"/>
        <option name="RESOURCE_LIST_WRAP" value="1"/>
        <option name="EXTENDS_LIST_WRAP" value="1"/>
        <option name="THROWS_LIST_WRAP" value="1"/>
        <option name="EXTENDS_KEYWORD_WRAP" value="1"/>
        <option name="THROWS_KEYWORD_WRAP" value="1"/>
        <option name="METHOD_CALL_CHAIN_WRAP" value="1"/>
        <option name="BINARY_OPERATION_WRAP" value="1"/>
        <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
        <option name="TERNARY_OPERATION_WRAP" value="1"/>
        <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
        <option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true"/>
        <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true"/>
        <option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true"/>
        <option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true"/>
        <option name="FOR_STATEMENT_WRAP" value="1"/>
        <option name="ARRAY_INITIALIZER_WRAP" value="1"/>
        <option name="ASSIGNMENT_WRAP" value="1"/>
        <option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true"/>
        <option name="WRAP_COMMENTS" value="true"/>
        <option name="ASSERT_STATEMENT_WRAP" value="1"/>
        <option name="ASSERT_STATEMENT_COLON_ON_NEXT_LINE" value="true"/>
        <option name="IF_BRACE_FORCE" value="3"/>
        <option name="DOWHILE_BRACE_FORCE" value="3"/>
        <option name="WHILE_BRACE_FORCE" value="3"/>
        <option name="FOR_BRACE_FORCE" value="3"/>
        <option name="WRAP_LONG_LINES" value="true"/>
        <option name="PARAMETER_ANNOTATION_WRAP" value="1"/>
        <option name="VARIABLE_ANNOTATION_WRAP" value="2"/>
        <option name="ENUM_CONSTANTS_WRAP" value="2"/>
        <option name="WRAP_ON_TYPING" value="0"/>
        <indentOptions>
            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="MySQL">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="Oracle">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="PostgreSQL">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="SQL">
        <option name="KEEP_LINE_BREAKS" value="false"/>
        <option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="SQLite">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="Sybase">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="TSQL">
        <indentOptions>
            <option name="SMART_TABS" value="true"/>
        </indentOptions>
    </codeStyleSettings>
</code_scheme>

另存为 Alibaba-CodeStyle.xml,然后在代码样式里导入 IDEA.xml 文件

配置文件版权

插件商店搜索 Copyright 然后在配置一下你的版权信息即可如下图:

/*Copyright (c) 2020-2030 it6666.top. All Rights Reserved.*/

去掉 Mapper 文件中 SQL 显示中的黄色背景

image-20211018225201256

配置文件头注释

Settings → Editor → File and Code Templates:

image-20211218165246119

/**
 * @author BNTang
 * @version V1.0
 * @project ${PROJECT_NAME}
 * @date Created in ${DATE} ${TIME}
 * @description ${description}
 **/

配置自动导包

image-20211218165542726

配置编码

打开 IDEA 的 vmoptions 文件,添加下面一行之后重启:

-Dfile.encoding=UTF-8

文件名称:

  • macOS:idea.vmoptions
  • Windows:idea64.exe.vmoptions

如上就是配置字体相关的内容了,之后有新的内容我会补齐进来。

End

posted @ 2021-04-15 16:13  BNTang  阅读(811)  评论(0编辑  收藏  举报