利用webstrom的宏,保存文件自动格式化代码
来源:互联网 发布:庚子赔款 知乎 编辑:程序博客网 时间:2024/06/06 00:00
这个git的截图大家是不是很熟悉,一个项目多人协作。有人提交前,格式化了代码,有人没有,进仓库的时候,各种合并!真正修改的几行,散落在这些无用的代码中,不方便快速定位!
如果大家都用同样的IDE,IDE在保存文件的时候,能自动格式化,就能最大限度的规避这种问题!
很幸运,webstorm正好有这个功能!
PS: go的fmt已经在语言级别实现保存自动格式代码了!不需要在ide设置宏!
参考资料:http://stackoverflow.com/questions/21217791/how-to-auto-format-code-in-webstorm
Record the macro
- Edit > Macros > Start Macro recording
- Press Ctrl+Alt+L, and then Ctrl+Alt+S
- Stop recording the macro clicking on the Stop button on the bottom right of the page.
- Give this macro a name like "Format and Save"
Assing Ctrl+S to "Format and Save"
- open WebStorm->Preferences;
- search for "keymap" and open it;
- search "Format and Save" and double click the action "Format and Save";
- select "Add Keyboard Shortcut";
- select "Cmd+S" as first stroke.
- it will report conflicts. Ignore it and click OK button
- WebStorm will show a warning "The shortcut is already assigned to other actions. Do you want to remove other assignments?" Click "Remove" button
That's it.
0 0
- 利用webstrom的宏,保存文件自动格式化代码
- Eclipse 保存文件时自动格式化代码
- Eclipse 保存文件时自动格式化代码
- Eclipse 保存文件时自动格式化代码
- Eclipse 保存文件时自动格式化代码
- Eclipse 保存文件时自动格式化代码
- Eclipse保存文件时自动格式化代码
- Eclipse 保存文件时自动格式化代码
- webstrom格式化代码和常用的快捷键
- webstrom代码格式化
- eclipse 保存自动格式化代码
- Eclipse 保存文件时自动格式化代码去除未使用的引用
- 取消eclipse myeclipse保存代码时的代码自动格式化
- webStrom 格式化代码快捷键&替换代码快捷键
- Android 代码保存时自动格式化
- Eclipse保存时自动格式化代码
- Eclipse之保存自动格式化代码
- Eclipse保存时自动格式化代码
- 【学习笔记】图像RGB三个分量的理解与显示
- dubbo service export过程
- android studio可恶的so文件
- 工厂模式的简单实现和快速理解--------(java复习)
- Spring对注解(Annotation)处理源码分析1——扫描和读取Bean定义
- 利用webstrom的宏,保存文件自动格式化代码
- Qt的4个图像类QImage/QPixmap/QBitmap/QPicture
- Spring对注解(Annotation)处理源码分析2——解析和注入注解配置的资源
- leetcode-12 Integer to Roman
- 朴素模式匹配算法java实现
- 重载函数编译后的新名字
- UDP协议的两个主要方法sendto和recvfrom详解
- 《MySQL学习笔记》:查询
- UIViewController - SenDylan