982
阅读时间:2m
作者: 谢先斌
分享
Jetbrains 出了一系列的编程工具,包括:idea、pycharm、goland等等。本文介绍这些工具的使用、主题设置、使用优化,插件安装,以及使用中常见问题等。
主题
下载
导入主题
在IDEA中导入该主题,具体如下:
file –> import setttings –> 选中 1 中下载的主题jar文件 –> 一路确认 –> 重启
设置主题
settings –> editor –> colors & fonts –> general
清除配置文件
rm -rf ~/Library/Preferences/Idea****
rm -rf ~/Library/Caches/Idea****
rm -rf ~/Library/Logs/Idea****
PS:以 idea 为例,其他的软件和这个类似。
优化
设置内存限制
help -> Edit Custom VM Options...
内容如下:
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:MaxMetaspaceSize=4096m
注:需重启。也可以更新 pycharm.vmoptions
,重启生效。
显示内存使用
File -> settings -> Apperance & Behavior -> Appearance 勾选 Show memory indicator
在 idea 的右下角,可以看到。
设置主题
黑色太难看了:
File -> Settings... (Ctrl + Alt + s) -> Appearance & Behavior -> Appearance -> UI Options -> Theme -> IntelliJ
调整字体
File -> Settings... (Ctrl + Alt + s) -> Editor -> Font -> Size
显示行号和空格符
File -> Settings -> Editor -> General -> Appearance
- Show line numbers
- Show whitespaces
- Leading
- Inner
- Trailing
Python PEP8 检测
Editor -> Inspections
配置
PEP8 coding style violation
PEP8 naming convention violation
中
Severity: Error
Python 插件安装
查看IDEA版本
在 help/about 中查看IDEA版本
IntelliJ IDEA 2017.2.6
Build #IU-172.4574.11, built on November 14, 2017
Licensed to lan yu
Subscription is active until October 14, 2018
JRE: 1.8.0_152-release-915-b12 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
下载插件
在 http://plugins.jetbrains.com/plugin/631
中下载对应的插件,172.4574.11
对应的是 python-143.116.zip
。
安装插件
-
windows下解压到 IDEA 的 plugins 目录,
ideaIU-2017.2.6.win\plugins\python
-
在IDEA中选择插件的安装方式为
File -> settings -> plugins -> Inatall plugin from disk...
注意:
-
此时选择
ideaIU-2017.2.6.win\plugins\python\lib\python.jar
安装,然后重启IDEA
-
创建
Python
项目,配置Python SDK
File/New Project/Python
,设置Project SDK
,E:\Python\python.exe
,创建Python
项目
- 在
Python
项目中new
一个Directory
或者是Packag
e,并写一个简单测试文件,测试Python
环境是否配置成功。
常见问题
CPU 占用较高问题
问题原因:
打开包含nodejs
项目时,包含node_modules
目录会导致 idea 一直 scanning files to index
会占用大量CPU资源
- 方法一:
可以直接修改 <project_name>.iml
文件跳过该目录文件的扫描,如下excludeFolder
配置:
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/frontend/node_modules" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
PS: .gitingore
中也应该有对应目录
- 方法二:
File
- Settings
- Project: yourprojectname
- Project Structure
- Right click on folder and press "Excluded"
- 方法二:
File
- Settings
- Editor
- File Types
- Ingore file and types
中填加 node_modules
调整快捷键
Preferences -> keymap -> 设置具体的快捷键,这里的快捷键,是安装菜单顺序排列的,可以按照菜单选择
相关文章
最新评论