本篇文章给大家带来的内容是关于webstorm使用的一些相关技巧,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
下面有较全的快捷键,慢慢熟练起来吧...
webstorm混搭svn
webstorm混搭nodejs
以less和uglify-js为例
如何用npm在root中下载模块
webstorm简单介绍
官网地址:http://www.jetbrains.com/webstorm/features/index.html
欲先善其事,必先利其器,如题。看到网上一篇介绍webstrom的文章,觉得功能确实强大,也知道为什么阿里巴巴的前端传到github上的文件为啥都有一个 .idea 文件,(传说淘宝内部推荐写js用webstrom)
我们可以理解 ide 就是集成了很多你想要的功能,或者你不想要的功能。换句话说就是装了很多插件的 editor ,所以到目前为止,我还觉得没必要给它装什么插件。
那么接下来开始介绍webstrom的特色功能:
webstorm 是 jetbrains 推出的一款商业的 javascript 开发工具
任何一个编辑器都需要保存(ctrl + s),这是所有win平台上编辑类软件的特点,但是webstorm编辑文件右上角是没有那个熟悉的 * 的。
好处:省去了ctrl + s之后,在结合firefox的vim,基本不动鼠标就可以看到结果页面了。
坏处:没有以前的 * 标识,万一键盘误操作也会被立即存储。
任何一个编辑器只要文件关闭了就没有历史记录了,但是webstorm有。 vcs->local history -> show history(快捷键:alt+~ -〉7)
好处:只要webstorm不关闭,你的文件随时可以返回到之前的操作(这也是为啥在 webstorm 里ctrl+y是删除一行的原因了)。
坏处:webstorm关闭重启后这些历史记录就没有了;还有一个坏处就是由此带来的内存消耗也必然比较大。
任何一个编辑器,除了服务器svn之外,没有本地版本,但是webstorm提供一个本地文件修改历史记录(快捷键:alt+shift+c,mac中 alt+option+c)。也可以 ctrl + e 弹出最近打开的文件。
好处:相当于本地svn。
坏处:内存消耗也必然比较大。
集成了zencoding,html5,ftp,即时编辑(chrome),自动完成,基于mozilla的javascript调试器,jslint、less支持、coffeescript支持、node.js、单元测试、集成git和svn版本控制等特性。
在编写css中,会智能的提示各种文件以及图片的路径,就不用再去确认这个文件是否存在了。
其他的特性就介绍了,想了解更多可以去webstrom官网继续寻找。看完了这么介绍以及那么多给力的特性,是不是有种冲动马上试一试这款传说中的前端神器啊?嗯。
首先在官方下载页下载webstrom后,点击安装,然后一直下一步,最后会出现需要注册码界面,因为webstrom是商业的ide,而天朝的屌丝前端当然没那么钱去买那么昂贵的神器了,不用担心,我们可以用webstorm的密钥来学习使用这款前端神器。嘿嘿~~~~
安装成功后,肯定会有些不适,就像我一样觉得这配色真的太戳了。还有一些设置也不是我也要的。那么以下我就列出我习惯的设置。
webstorm设置技巧如何更改主题(字体&配色):
file -> settings -> editor -> colors&fonts -> scheme name.主题下载地址
如何让webstorm启动的时候不打开工程文件:
file -> settings->general去掉reopen last project on startup.
如何完美显示中文:
file -> settings->appearance中勾选override default fonts by (not recommended),设置name:nsimsun,size:12
如何显示行号:
file -> settings->editor,”show line numbers”打上勾,就显示行号了
如何代码自动换行:
file -> settings -> editor “use soft wraps in editor” 打上钩,代码就自动换行了
如何点击光标,显示在本行末尾:
file -> settings->editor “allow placement of caret after end of line”去掉勾就行了。
如何修改快键键:
file -> settings->keymap,然后双击要修改快捷的功能会有提示框出来,按提示操作
换成自己熟悉编辑器的快键键:
file ->settings->keymap,支持像visual studio、eclipse、netbeans这样的主流ide。
javascript类库提示。
file -> settings -> javascript -> libraries -> 然后在列表里选择自己经常用到的javascript类库,最后download and install就ok了.
在开发js时发现,需要ctrl + return 才能选候选项:
file -> setting -> editor -> code completion -> preselect the first suggestion: “smart” 改为 “always”
js提示比较迟缓
file -> code completion -> autopopup in 下 1000改为0
git配置:
file -> settings -> editor -> github,进去改github的账户,如果没有git则不需要.
插件安装:
file ->plugins,然后就选择给力的插件们再安装.(“css-x-fire”插件,用于当使用firebug修改css属性时,编辑器内的css代码也会发生变化。)
以后更新
webstorm使用心得收藏夹功能:
当工程目录很庞大时,有些子目录很经常打开,但层级又很深,这时候可以把目录添加到收藏夹里面,添加成功后,左侧有个“favorites”菜单
面包屑导航:
除了左侧的工程页面,可以选择目录之外,在顶部菜单下有一个类似网站面包屑导航一样的目录也可以实现相同功。点击每个目录就会有下拉菜单显示其下的子目录,很实用.
构造器界面:
注释符合格式的话就会出现。如果是js文件则是js类的函数和对象;css文件的话则是这个css文件的概括;html文件的话则是节点的结构图。话说这几个就是为了方便查看代码的结构性.
todo界面:
给代码加todo注释就会出现这个界面
双栏代码界面:
右击代码选项卡上的文件,然后右键 -> spilt vertically(左右两屏)或者spilt horizontally(上下两屏)
本地历史功能:
找回代码的好办法
webstorm集成git使用webstorm中只集成了git的常用操作,并不能完全替代命令行工具。在界面的右下角可以查看处于哪个git分支。也可以在上面点击切换或者新建分支。
查看当前代码与版本库代码的差异:
右击代码界面任意区域,选择git -> compare with然后选择要比较的版本库。
webstorm快捷键说明editing编辑相关快捷键
ctrl + space:
basic code completion (the name of any class, method or variable) 基本代码完成(任何类、函数或者变量名称),改为alt+s
ctrl + shift + enter:
complete statement 补全当前语句
ctrl + p:
parameter info (within method call arguments) 参数信息 包括方法调用参数
ctrl + mouse over code
brief info 简单信息
ctrl + f1
show description of error or warning at caret 显示光标所在位置的错误信息或者警告信息
alt + insert
generate code…(getters, setters, constructors)新建一个文件或者生成代码,…构造函数,可以创建类里面任何字段的getter与setter方法
ctrl + o
override methods 重载方法
ctrl + i
implement methods 实现方法
ctrl + alt + t
surround with…(if, else, try, catch, for, etc)用 * 来围绕选中的代码行,( * 包括 if 、 while 、 try catch 等)
ctrl + /
comment/uncomment with line comment 行注释/取消行注释
ctrl + shift + /
comment/uncomment with block comment 块注释/取消块注释
ctrl + w
select successively increasing code blocks 选择代码块,一般是增量选择
ctrl + shift + w
decrease current selection to previous state 上个快捷键的回退,减量选择代码
alt + q
context info 上下文信息
alt + enter
show intention actions and quick-fixes 意图行动,快速见效
ctrl + alt + l
reformat code 根据模板格式对代码格式化
tab/ shift + tab
indent/unindent selected lines 对所选行进行缩排处理/撤销缩排处理
ctrl + x or shift + delete
cut current line or selected block to clipboard 剪切当前行或所选代码块到剪切板
ctrl + c or ctrl + insert
copy current line or selected block to chipboard 拷贝当前行或者所选代码块到剪切板
ctrl + v or shift + insert
paste from clipboard 粘贴剪切板上的内容
ctrl + shift + v
paste from recent buffers 粘贴缓冲器中最新的内容
ctrl + d
duplicate current line or selected block 复制当前行或者所选代码块
ctrl + y
delete line at caret 删除光标所在位置行
ctrl + shift + j
smart line join(html and javascript only)加入智能行 (html 和javascript)
ctrl + enter
smart line split(html and javascript only)分离智能行 (html 和javascript)
shift + enter
start new line 另起一行
ctrl + shift + u
toggle case for word at caret or selected block 光标所在位置大小写转换
ctrl + shift + ]/[
select till code block end/start 选择直到代码块结束/开始
ctrl + delete
delete to word end 删除文字结束
ctrl + backspace
delete to word start 删除文字开始
ctrl + numpad+/-
expand/collapse code block 扩展/缩减代码块
ctrl + shift+ numpad+
expand all 扩张所有
ctrl + shift+ numpad-
collapse 缩减所有
ctrl + f4
close active editor tab 关闭活跃编辑标签
search/replace搜索/替代相关快捷键
ctrl + f
find 当前文件内快速查找代码
ctrl + shift + f
find in path 指定文件内寻找路径
f3
find next 查找下一个
shift + f3
find previous 查找上一个
ctrl + r
replace 当前文件内代码替代
ctrl + shift + r
replace in path 指定文件内代码批量替代
usage search搜索相关快捷键
alt + f7/ctrl + f7
find usages/find usages in file 找到使用/在文件找到使用
ctrl + shift + f7
highlight usages in file文件中精彩使用
ctrl + alt + f7
show usages 显示使用
running运行
alt + shift + f10
select configuration and run 选择构架,运行
alt + shift + f9
select configuration and debug 选择构架,修补漏洞
shift + f10
run 运行
shift + f9
debug 修补漏洞
ctrl + shift + f10
run context configuration from editor 从编辑运行内容构架
ctrl + shift + x
run command line 运行命令行
debugging debugging相关快捷键
f8
step over 不进入函数
f7
step into 单步执行
shift + f7
smart step into 智能单步执行
shift + f8
step out 跳出
alt + f9
run to cursor 运行到光标处
alt+ f8
evaluate expression 评估表达
f9
resume program 重新开始程序
ctrl + f8
toggle breakpoint 切换断点
ctrl + shift + f8
view breakpoints 查看断点
navigation 定位相关快捷键
ctrl + n
go to class跳转到指定类
ctrl + shift + n
go to file 通过文件名快速查找工程内的文件
ctrl + alt +shift + n
go to symbol 通过一个字符查找函数位置
alt + right/ left
go to next/ previous editor tab 进入下一个/ 上一个编辑器选项
f12
go back to previous tool window 进入上一个工具窗口
esc
go to editor(from tool window) 从工具窗口进入编辑器
shift + esc
hide active or last active window 隐藏活动窗口
ctrl + shift + f4
close active run/message/find/…tab 关闭活动….标签
ctrl + g
go to line 跳转到第几行
ctrl + e
recent files popup 弹出最近打开的文件
ctrl + alt + left/right
navigate back/forward 导航前进/后退
ctrl + shift + backspace
navigate to last edit location 向最近编辑定位导航
alt + f1
select current file or symbol in any view 查找当前选中的代码或文件在其他界面模块的位置
ctrl + b or ctrl + click
go to declaration跳转到定义处
ctrl + alt + b
go to implementation(s) 跳转方法实现处
ctrl + shift + b
go to type declaration 跳转方法定义处
ctrl + shift + i
open quick definition lookup 打开定义快速查找
ctrl + u
go to super-method/super-class 跳转方法/超阶级
alt + up/down
go to previous/next method 在方法间快速移动定位
ctrl + ]/[
move to code block end/start 跳转到编码块结束/开始
ctrl + f12
file structure popup 文件结构弹出
ctrl + h
type hierarchy 类型层次
ctrl + alt + h
call hierarchy 调用层次结构
f2/ shift + f2
next/previous highlighted error 跳转到后一个/前一个错误,高亮错误或警告快速定位,使用这个快捷键可以快捷在出错的语句之间进行跳转。
f4/ctrl + enter
edit source/ view source 编辑源代码/查看源代码
alt + home
show navigation bar 显示导航栏
f11
toggle bookmark 切换标记
ctrl + f11
toggle bookmark with mnemonic 采用记忆切换标记
ctrl + #[0-9]
go to numbered bookmark 跳转到带编号的标记
shift + f11
show bookmark 显示标记
refactoring 重构相关快捷键
f5
copy 拷贝
f6
move 移动
alt + delete
safe delete 安全删除
shift + f6
rename 重新命名
ctrl + alt + n
inline variable 嵌入变量
ctrl + alt + m
extract method( javascript only) 提取函数
ctrl + alt + v
introduce variable 引入变量
ctrl + alt + f
introduce field 引入域
ctrl + alt + c
introduce constant 引入常量
vcs/local history 版本控制系统/ 本地历史相关快捷键
alt + backquote( )
‘vcs’quick popup 快速弹出 vcs
ctrl + k
commit project to vcs 提交项目至vcs
ctrl + t
update project from vcs 从vcs 更新项目
alt + shift + c
view recent changes 查看最新改变
general 常用的相关快捷键
ctrl + shift +a
find action 查找并调用编辑器的功能
alt + #[0-9]
open corresponding tool window 快速切换打开界面模块
ctrl + alt + f11
toggle full screen mode 切换全屏模式
ctrl + shift + f12
toggle maximizing editor 切换最大化编辑器
alt + shift + f
add to favorites 将当前文件添至收藏夹
alt + shift + i
inspect current file with current profile 使用当前属性检查当前文件
ctrl + backquote( )
quick switch current scheme 快速转换现有组合
ctrl + alt + s
open setting dialog 打开设置对话框
ctrl + tab
switch between tabs and tool window 标签和工具窗的转换(与windows快捷键冲突)
以上就是webstorm使用的一些相关技巧的详细内容。