WebStorm 2021.2 Help

WebStorm keyboard shortcutsWebStorm键盘快捷键

WebStorm has keyboard shortcuts for most of its commands related to editing, navigation, refactoring, debugging, and other tasks. WebStorm的大多数与编辑、导航、重构、调试和其他任务相关的命令都有键盘快捷键。Memorizing these hotkeys can help you stay more productive by keeping your hands on the keyboard.记住这些热键可以让你的手保持在键盘上,从而提高工作效率。

Predefined keymaps do not cover every possible platform, version, and configuration. 预定义的密钥映射并不涵盖所有可能的平台、版本和配置。Some shortcuts can conflict with global system actions and shortcuts for third-party software. 某些快捷方式可能与全局系统操作和第三方软件的快捷方式冲突。WebStorm detects the conflicts and notifies you with a popup message. WebStorm检测到冲突并用弹出消息通知您。To fix these conflicts, you can reassign or disable the conflicting shortcut as described in Conflicts with global OS shortcuts.要修复这些冲突,可以按照与全局操作系统快捷方式的冲突中的说明重新分配或禁用冲突的快捷方式。

The following table lists some of the most useful shortcuts to learn:下表列出了一些最有用的学习快捷方式:

Shortcut快捷键Action操作
Double 两次Shift

Search Everywhere随处搜索

Quickly find any file, action, class, symbol, tool window, or setting in WebStorm, in your project, and in the current Git repository.在WebStorm、项目和当前Git存储库中快速查找任何文件、操作、类、符号、工具窗口或设置。

Ctrl+Shift+A

Find Action查找操作

Find a command and execute it, open a tool window, or search for a setting.查找并执行命令、打开工具窗口或搜索设置。

Double 两次Ctrl

Run Anything运行一切

Launch run/debug configurations, run npm and yarn scripts, and reopen recent projects.启动运行/调试配置,运行npm和Thread脚本,并重新打开最近的项目。

Alt+Enter

Show Context Actions显示上下文操作

Quick-fixes for highlighted errors and warnings, intention actions for improving and optimizing your code.快速修复突出显示的错误和警告,改进和优化代码的意图操作。

F2
Shift+F2

Navigate between code issues在代码问题之间导航

Jump to the next or previous highlighted error.跳转到下一个或上一个突出显示的错误。

Ctrl+E

View recent files查看最近的文件

Select a recently opened file from the list.从列表中选择最近打开过的文档。

Ctrl+W
Ctrl+Shift+W

Extend or shrink selection扩展或收缩选区

Increase or decrease the scope of selection according to specific code constructs.根据特定的代码构造增加或减少选择范围。

Ctrl+/
Ctrl+Shift+/

Add/remove line or block comment添加/删除行注释或块注释

Comment out a line or block of code.注释掉一行或一段代码。

Alt+F7

Find Usages查找用法

Show all places where a code element is used across your project.显示在项目中使用代码元素的所有位置。

If you are using one of the predefined keymaps for your OS, you can print the default keymap reference card and keep it on your desk to consult it if necessary. 如果您正在为您的操作系统使用一个预定义的键图,您可以打印默认的键图参考卡,并将其放在桌上,以便在必要时查阅。This cheat sheet is also available under Help | Keymap Reference.本备忘单也可在“帮助”|“键舯映射参考”下获得。

Choose the right keymap选择正确的键映射

To view the keymap configuration, open the Settings/Preferences dialog Ctrl+Alt+S and select Keymap.要查看键映射配置,请打开“设置/首选项”对话框Ctrl+Alt+S并选择键映射。

  • Use a predefined keymap使用预定义的键映射

    WebStorm automatically suggests a predefined keymap based on your environment. WebStorm会根据您的环境自动建议预定义的密钥映射。Make sure that it matches the OS you are using or select the one that matches shortcuts from another IDE or editor you are used to (for example, Eclipse or NetBeans).确保它与您正在使用的操作系统相匹配,或者选择与您使用的另一个IDE或编辑器(例如Eclipse或NetBeans)的快捷方式相匹配的操作系统。

    When consulting this page and other pages in WebStorm documentation, you can see keyboard shortcuts for the keymap that you use in the IDE — choose it using the selector at the top of a page.查阅此页面和WebStorm文档中的其他页面时,可以看到IDE中使用的键映射的键盘快捷键-使用页面顶部的选择器选择它。

  • Tune your keymap调整你的键映射

    You can modify a copy of any predefined keymap to assign your own shortcuts for commands that you use frequently.您可以修改任何预定义键映射的副本,以便为经常使用的命令指定自己的快捷方式

  • Import custom keymap导入自定义键映射

    If you have a customized keymap that you are used to, you can transfer it to your installation.如果您有一个习惯使用的自定义密钥映射,则可以将其转移到安装中

Besides the default set of keymaps, you can add more as plugins (such as, keymaps for GNOME and KDE): open the Settings/Preferences dialog Ctrl+Alt+S, select Plugins and search for keymap in the Marketplace.除了默认的键映射集,您还可以添加更多的插件(例如GNOME和KDE的键映射):打开“设置/首选项”对话框Ctrl+Alt+S,选择“插件”并在市场中搜索“keymap”。

Print your keymap打印您的键映射

If you prefer a hard copy, download the default WebStorm keymap reference and print it out as a card:如果您喜欢硬拷贝,请下载默认的WebStorm keymap参考并将其打印为卡片:

Learn shortcuts as you work在工作中学习快捷键

WebStorm provides several possibilities to learn shortcuts:WebStorm提供了几种学习快捷方式的可能性:

  • Find Action is the most important command that enables you to search for commands and settings across all menus and tools.查找操作是最重要的命令,它使您能够在所有菜单和工具中搜索命令和设置。

    Press Ctrl+Shift+A and start typing to get a list of suggested actions. Ctrl+Shift+A并开始键入以获取建议操作的列表。Then select the necessary action and press Enter to execute it.然后选择必要的操作并按Enter键执行。

    Find Action
  • Key Promoter X is a plugin that shows a popup notification with the corresponding keyboard shortcut whenever a command is executed using the mouse. Key Promotor X是一个插件,每当使用鼠标执行命令时,它都会显示带有相应键盘快捷键的弹出通知。It also suggests creating a shortcut for commands that are executed frequently.它还建议为频繁执行的命令创建快捷方式。

  • If you are using one of the predefined keymaps for your OS, you can print the default keymap reference card and keep it on your desk to consult it if necessary. 如果您正在为您的操作系统使用一个预定义的键图,您可以打印默认的键盘映射参考卡,并将其放在桌上,以便在必要时查阅。This cheat sheet is also available under Help | Keymap Reference.本备忘单也可在“帮助”|“关盘映射参考”下获得。

  • To print a non-default or customized keymap, use the Keymap exporter plugin.要打印非默认或自定义的keymap,请使用键盘映射导出器插件

Use advanced features使用高级功能

You can further improve your productivity with the following useful features:您可以通过以下有用的功能进一步提高生产率:

  • Quick Lists快速列表

    If there is a group of actions that you often use, create a quick list to access them using a custom shortcut. 如果您经常使用一组操作,请创建一个快速列表,使用自定义快捷方式访问这些操作。For example, you can try using the following predefined quick lists:例如,您可以尝试使用以下预定义的快速列表:

    • Refactor this重构这个 Ctrl+Alt+Shift+T

    • VCS Operations版本控制操作 Alt+`

  • Smart Keys智能钥匙

    WebStorm provides a lot of typing assistance features, such as automatically adding paired tags and quotes, and detecting CamelHump words.WebStorm提供了许多打字辅助功能,例如自动添加成对的标记和引号,以及检测驼峰词。

  • Speed search

    When the focus is on a tool window with a tree, list, or table, start typing to see matching items.当焦点位于具有树、列表或表的工具窗口上时,开始键入以查看匹配项

  • Press twice按两下

    Many actions in WebStorm provide more results when you execute them multiple times. WebStorm中的许多操作在多次执行时提供更多结果。For example, when you invoke basic code completion with Ctrl+Space on a part of a field, parameter, or variable declaration, it suggests names depending on the item type within the current scope. 例如,当您在字段、参数或变量声明的一部分上使用Ctrl+Space调用基本代码补全时,它会根据当前范围内的项类型建议名称。If you invoke it again, it will include classes available through module dependencies. 如果您再次调用它,它将包括通过模块依赖关系可用的类。When invoked for the third time in a row, the list of suggestions will include the whole project.当连续第三次调用时,建议列表将包括整个项目。

  • Resize tool windows调整工具窗口的大小

    You can adjust the size of tool windows without a mouse:您可以在不使用鼠标的情况下调整工具窗口的大小:

    • To resize a vertical tool window, use Ctrl+Shift+Left and Ctrl+Shift+Right要调整垂直工具窗口的大小,请使用Ctrl+Shift+LeftCtrl+Shift+Right

    • To resize a horizontal tool window, use Ctrl+Shift+Up and Ctrl+Shift+Down要调整水平工具窗口的大小,请使用Ctrl+Shift+UpCtrl+Shift+Down

Last modified: 09 June 2021