不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2013-10-18 21:54:14  修改时间:2024-04-19 07:37:30  分类:电脑/软件使用  编辑

1、"自定义"常用快捷键(设置成跟Eclipse差不多)

按照路径:File -> Settings -> Appearance & Behavior -> Keymap -> Copy 一份 Eclipse,命名为 Eclipse_wen-jianbao

快捷键 功能 路径
Ctrl + / 双斜杠注释 Main menu -> Code -> Comment width Line Comment
Ctrl + Shilft + / 块注释 Main menu -> Code -> Comment width Block Comment
Alt + / 代码提示 Main menu -> Code -> Completion -> Basic 
Ctrl + I 格式化代码 Main menu -> Code -> Reformat Code
Ctrl + D 删除当前行 Editor Actions -> Delete Line
Ctrl + E 最近打开的文件列表 Main menu -> View -> Recent Files
Ctrl + W 关闭正在编辑的活动窗口。 Main menu -> Window -> Editor Tabs -> Close
Ctrl + F 当前文件 搜索、替换 Main menu -> Edit -> Find -> Replace
Ctrl + R 高级 查找替换【批量替换 Main menu -> Edit -> Find -> Replace in Path
Ctrl + H 高级 查找 Main menu -> Edit -> Find -> Find in Path
Ctrl + L 定位到指定行 Main menu -> Navigate -> Line
Ctrl + G 查找某个函数在项目中的使用统计 Main menu -> Edit -> Find -> Find Usages
Ctrl + Alt + ↓ 复制当前行到下(上)一行中。比Ctrl+C单纯的复制功能要方便好用(省掉了粘贴步骤),主要是用在编写代码时,需要移动代码的地方。 Editor Actions -> Duplicate Entire Lines
Alt + ↓
Alt + ↑
移动单行(多行)代码。也是比Ctrl+C更好的快捷键。 Main menu -> Code -> Move Statement Down

Main menu -> Code -> Move Statement Up
Ctrl + Shift + R 根据文件名(模糊查询)快速定位文件(任何类型) Main menu -> Navigate -> File
Ctrl + Shift + U 大小写转换 Main menu -> Edit -> Toggle Case
F1 查看文档 Main menu -> View -> Quick Documentation
F2 重命名 Main menu -> Refactor -> Rename
Alt + Enter 导入 类的命令空间  

 

弱弱的补充说明一下:

新买了一台 ThinkPad E440,尽管关闭/禁用了 屏幕的快捷键 Ctrl + Alt + ↓,但是在 PhpStorm中这组快捷键还是不能用,没办法,最后换成了新的组合键 Ctrl + Alt + PageDown

 

平常还是习惯 F1 为查看PHP函数文档快捷键, F2 为重命名快捷键,但是这2个键被占用:

1、把 View -> Quick Documentation 的快捷键设置为 F1

2、把 Refactor -> Rename 的快捷键设置为 F2

3、把 Code -> Reformat Code 的快捷键设置为 Ctrl + I

 

#多项目并存的问题:

PhpStorm不知道什么原因,一个工程要打开一个ide,后来找到一个方法,可以并存:

File -> settings -> Directories -> Add Content Root 中添加你当前的工程目录,如下图所示:

另外,在 “Project”面板那,把显示类型切换到 “Project”状态,这样就可以显示所有的项目了!如下图所示:

 

#如何更换主题

默认的字体和背景色都是挺伤眼睛的,但是我们可以手动更换其他更好的主题:

可以从这个网站(http://phpstorm-themes.com)下载各类主题的xml文件,

然后将文件放到PhpStorm的文件夹中,比如:c:/Users/USERNAME/.WebIde10/config/colors,

如果此时正好开着PhpStorm,那么需要重启一下该IDE,以便载入改成你添加的主题,

在IDE的左上角菜单中,选择 File > Settings > Editor > Colors & Fonts ,然后在下拉菜单中,选中你刚才添加的主题名称,保存设置后,就大功告成了。

说明:其实上面网站提供的主题,我一个都不喜欢,也没用。后来,我是参考 Eclipse 3.7.2 for JaveEE 的默认主题(我挺喜欢的),通过对比,一步步把PhpStorm设置自己喜欢的代码格式/样式,设置地址为:

File -> Settings -> Editor -> Colors & Fonts -> PHP,其他语言(如 JavaScript,Html,CSS)同理设置!

 

#PhpStorm横向滚动条过短

解决PhpStorm横向滚动条过短的BUG,设置编程字体 Consolas

 

#显示 空格/空白、行号

指将空格/tab等空白字符显示成小圆点等可见字符,显示后的效果是这样的,注意看缩进处的空白

定义空格的颜色:Editor -> Color Scheme -> General -> Text -> Whitespaces -> Foreground: CECECE,现改为 AFAFAF,再改为 BCE2C1

 

# 设置 代码块 竖线 的颜色

第一步:显示出 竖线

Editor -> General -> Appearance ->

(1) 勾选“Show hard wrap guide(configured in Code Style options)”   # 显示 代码区 右边的 竖线
(2) 勾选“Show indent guides”   # 显示 代码块 左边的 对齐竖线

第二步:设置 竖线 颜色

Editor -> General -> Color Scheme -> General -> 右边选框 -> Editor -> Guides ->
  (1) Hard wrap guide -> 勾选 Foreground,值为:B0B0B0 (注意:后来改为 999999
  (2) Indent guide -> 勾选 Background,值为:B0B0B0 (注意:后来改为 999999
  (3) Indent guide selected -> 勾选 Background,值为:FF0000

 

#关闭 “去掉行尾空格” 的功能 (不然的话,很容易产生 SVN/Git 的修改记录)

Editor -> Color Scheme -> General -> Other -> Strip trailing spaces on Save: 选择 None

 

#打开PhpStrom时,不打开“上次打开的项目”

File -> IDE Setting -> General -> Startup/Shutdown -> 去掉勾选“Reopen last project on startup”

 

#去掉“单词拼写检查”

File -> Settings -> Editor -> Inspections -> Spelling -> 去掉改勾选 Typo

 

#配置PHP解释器和PHP语言版本

File -> Settings -> Languages & Frameworks -> PHP

-> PHP language level: 5.4(traists,short array syntax,etc. )
-> Interpreter: PHP5.4

 

#修改文件自动保存

File -> IDE Setting -> General -> Synchronization -> 勾选“Save files on frame deactivation”

新版路径:File -> Appearance & Behavior -> System Settings -> Synchronization -> 

 

#如何卸掉 PhpStorm 插件?

File -> Settings -> IDE Settings -> Plugins -> 去掉勾选插件的“复选框”即可

我想卸掉:

ASP
CVS Integration
Database Tools and SQL
Drupal Support
Git Integration  (喜欢用TortoiseGit
GitHub
Google App Engine Support for PHP
Java Server Pages Integration
SSH Remote Run
Remote Hosts Access
PHP Remote Interpreter
SSH Remote Run
Subversion Intrgration (保留这个,和TortoiseSVN一起用)
WordPress Support
Terminal (cmd命令行控制台)

PhpStorm自带了好几款“版本控制系统(VCS:Version Control System)”

Subversion Integration【只保留这边】
Mercurial
Perforce Integration
CVS Integration
Git Integration
TFS Integration

#安装 JS/CSS压缩工具

Assets Compressor:Compressing js and css files, go to Refactor > Compress

 

#去掉自动检测 新版本

File -> Settings -> Updates -> 去掉勾选 Check for updates in channel

 

#去掉右上角的 浏览器工具栏

[PhpStorm_7.x] File -> Settings -> IDE Settings -> Web Browsers -> 去掉勾选 

[PhpStorm_9.x] File -> Settings -> Tools -> Web Browsers -> 去掉勾选

 

# 输入“右}”时,不要格式化代码块

File -> Settings -> Editor -> General -> Smart Keys

-> (a).去掉勾选 Backspace smart indent

-> (b).去掉勾选“Reformat block on typing '}'”

-> (c).Reformat on paster: 选择 None

# 去掉 计算代码长度

File -> Settings -> Editor -> General -> Appearance

去掉勾选 Show code lens on scrollbar hover

# 如何导出个性化设置,备份或给他人用?

导出:File -> Exporting Settings

导入:File -> Importing Settings

 

# 去掉 工具面板 名字前面的数字

File -> Settings -> Editor -> Windows Options -> 去掉勾选“Show tool window numbers

IDE 精髓

# 开启PHP语法“检错提醒”功能【注意:这个功能相当重要!】

File -> Settings -> Editor -> Inspections -> PHP -> 勾选需要检错提醒项

# 去掉“Inspections”中的单词拼写检错“Spelling”的功能

File -> Settings -> Editor -> Inspections -> Spelling -> 去掉勾选

# 隐藏 导航栏

View -> Navigation Bar

 

# 去掉代码区的“面包屑”

File -> Settings -> Editor -> General -> Appearance -> 去掉勾选“Show breadcrumbs”

 

# 自动完成命令设置,例如 输入"DD" 自动完成 Yii::$app->utils->debug();

File -> Settings -> Editor -> Editor -> Live Templates

 

# Ubuntu 下,创建 PhpStorm/Clion 桌面图标

Tools -> Create Desktop Entry

 

# 去掉 phpDoc 中 捕获异常的 提醒 @throws Exception

(1) File -> Default Settings -> Editor -> Inspections -> PHP -> Error handling -> 去掉勾选:Unhandled exception

(2) File -> Default Settings -> Editor -> Inspections -> PHP -> PHPDoc -> 去掉勾选:Missing @throws tag(s)

 

#去掉 PhpStrom 保存的 密码(SVN,GIT)

File -> Setting -> System Settings -> Passwords -> Save passwords -> 勾选“In KeePass

如果要 保存密码,则勾选 “In native Keychain

修复 Windows 10 下,PhpStorm 自带 git 项目,输错密码后,不能修改密码的 问题!

 

#格式化代码,设置等号对齐#

(1) 变量按等号=对齐

(2) 数组键值对按=>对齐

类字段对齐:

Preferences -> Editor -> Code Style -> PHP -> Wrapping and Braces -> Class field/constant groups,同时勾选

  • Align fields in columns
  • Align constants

PhpStorm 注释的时候的 斜线位置不在缩进的位置

 

 


字体设置

Settings -> Appearance & Behavior -> Appearance -> 勾选 Override default fonts by: Name: 选择“微软雅黑”,Size: 12

Settings -> Editor -> Colors & Fonts -> Primary font:选择“YaHei Consolas Hybrid”,Size: 14,Line spacing: 1.2

 

 

延伸阅读:

  1. 修复 Windows 10 下,PhpStorm 自带 git 项目,输错密码后,不能修改密码的 问题!
  2. Mac 下,更改 隐藏软件窗口 快捷键 command+h,解决与 PhpStorm、IDEA 等开发工具“查找”快捷键冲突的问题