Skip to content
On this page

🎯背景

对于开发者来说,最熟悉的调试工具之一莫过于 googleconsole 控制台。那为什么周一会想到要来整理 console 的快捷键呢,原因在于,最近在开发中,有较大的控制台使用频率。用着用着发现,每回想要点按光标或者hover等功能时候,都得鼠标移进移出的,这其实有一点影响开发效率。于是带着这个困扰,周一踏上了整理 console 快捷键的征程。下面将整理console相关一些比较常用的快捷键。

关于 console 快捷键相关网站:https://developer.chrome.com/docs/devtools/shortcuts/?utm_source=devtools。以下所有快捷键将在**控制台面板**中执行才有效哦~

⌨️通用快捷键

打开调试工具

功能Mac OSWindows / Linux
打开最后一次使用过的面板Command+Option+IF12 or Control+Shift+I
打开Console面板Command+Option+JControl+Shift+J
打开Elements面板Command+Shift+C or Command+Option+CControl+Shift+C

全局快捷键

功能Mac OSWindows / Linux
展示控制台中的 settings 设置面板,可以按Esc退出F1 or Function+F1F1
切换到下一个面板Command+]Control+]
切换到上一个面板Command+[Control+[
切换到上一个曾经使用过的面板位置Command+Shift+DControl+Shift+D
切换设备的模式(手机/网页模式)Command+Shift+MControl+Shift+M
切换到检查元素的模式(光标模式)Command+Shift+CControl+Shift+C
打开 Command 菜单Command+Shift+PControl+Shift+P
拉出 抽屉EscapeEscape
普通刷新Command+RF5 or Control+R
强制刷新Command+Shift+RControl+F5 or Control+Shift+R
搜索当前面板的文本(仅支持Elements、Console、Sources、Performance、Memory、JavaScript Profiler和Quick Source)Command+FControl+F
打开抽屉里面的搜索(这里可以搜索所有已加载的资源)Command+Option+FControl+Shift+F
打开Souces面板里面的某一个文档Command+O or Command+PControl+O or Control+P
放大面板Command+Shift++Control+Shift++
缩小面板Command+-Control+-
恢复初始化面板的大小Command+0

⌨️各面板快捷键

Element面板

ActionMacWindows / Linux
撤销Command+ZControl+Z
重做Command+Shift+ZControl+Y
选择已选择元素的上一行/下一行向上↑ / 下↓箭头向上↑ / 下↓箭头
展开当前已选择元素的节点(如果当前节点已经被展开,那么这个快捷键将会去选择在这个节点下面的元素)向右箭头→向右箭头→
折叠当前已选择元素的节点(如果当前节点已经被折叠,那么这个快捷键将会去选择在这个节点上面的那个元素)向左箭头←向左箭头←
展开/折叠当前已选择节点,和展开/折叠已选择节点的所有子节点按住option并且点击左/右箭头按住Control+Alt并且点击左/右箭头
将当前已选择元素切换为属性可编辑的模式EnterEnter
选择下一个/上一个可编辑的属性Tab / Shift+TabTab / Shift+Tab
隐藏当前已选择的元素HH
将当前已选择选择切换成 Edit as HTML 的模式Function+F2F2

Style面板

ActionMacWindows / Linux
Go to the line where a property value is declaredHold Command then click the property valueHold Control then click the property value
Cycle through the RBGA, HSLA, and Hex representations of a color valueHold Shift then click the Color Preview box next to the valueHold Shift then click the Color Preview box next to the value
Select the next / previous property or valueClick a property name or value then press Tab / Shift+TabClick a property name or value then press Tab / Shift+Tab
Increment / decrement a property value by 0.1Click a value then press Option+Up Arrow / Option+Down ArrowClick a value then press Alt+Up Arrow / Alt+Down Arrow
Increment / decrement a property value by 1Click a value then press Up Arrow / Down ArrowClick a value then press Up Arrow / Down Arrow
Increment / decrement a property value by 10Click a value then press Shift+Up Arrow / Shift+Down ArrowClick a value then press Shift+Up Arrow / Shift+Down Arrow
Increment / decrement a property value by 100Click a value then press Command+Up Arrow / Command+Down ArrowClick a value then press Control+Up Arrow / Control+Down Arrow
Cycle through the degrees (deg), gradians (grad), radians (rad) and turns (turn) representations of an angle valueHold Shift then click the Angle Preview box next to the valueHold Shift then click the Angle Preview box next to the value
Increment / decrement an angle value by 1Click the Angle Preview box next to the value then press Up Arrow / Down ArrowClick the Angle Preview box next to the value then press Up Arrow / Down Arrow
Increment / decrement an angle value by 10Click the Angle Preview box next to the value then press Shift+Up Arrow / Shift+Down ArrowClick the Angle Preview box next to the value then press Shift+Up Arrow / Shift+Down Arrow
Increment / decrement an angle value by 15Click the Angle Preview box next to the value then press Shift, click / mouse slide on the Angle Clock OverlayClick the Angle Preview box next to the value then press Shift, click / mouse slide on the Angle Clock Overlay

Souces面板

ActionMacWindows / Linux
Pause script execution (if currently running) or resume (if currently paused)F8 or Command+\F8 or Control+\
Step over next function callF10 or Command+'F10 or Control+'
Step into next function callF11 or Command+;F11 or Control+;
Step out of current functionShift+F11 or Command+Shift+;Shift+F11 or Control+Shift+;
Continue to a certain line of code while pausedHold Command and then click the line of codeHold Control and then click the line of code
Select the call frame below / above the currently-selected frameControl+. / Control+,Control+. / Control+,
Save changes to local modificationsCommand+SControl+S
Save all changesCommand+Option+SControl+Alt+S
Go to lineControl+GControl+G
Jump to a line number of the currently-open filePress Command+O to open the Command Menu, type : followed by the line number, then press EnterPress Control+O to open the Command Menu, type : followed the line number, then press Enter
Jump to a column of the currently-open file (for example line 5, column 9)Press Command+O to open the Command Menu, type :, then the line number, then another :, then the column number, then press EnterPress Control+O to open the Command Menu, type :, then the line number, then another :, then the column number, then press Enter
Go to a function declaration (if currently-open file is HTML or a script), or a rule set (if currently-open file is a stylesheet)Press Command+Shift+O, then type in the name of the declaration / rule set, or select it from the list of optionsPress Control+Shift+O, then type in the name of the declaration / rule set, or select it from the list of options
Close the active tabOption+WAlt+W
Toggle the Navigation sidebar on the leftCommand+Shift+YControl+Shift+Y
Toggle the Debugger sidebar on the rightCommand+Shift+HControl+Shift+H

代码编辑器

ActionMacWindows / Linux
Delete all characters in the last word, up to the cursorOption+DeleteControl+Delete
Add or remove a line-of-code breakpointFocus your cursor on the line and then press Command+BFocus your cursor on the line and then press Control+B
Go to matching bracketControl+MControl+M
Toggle single-line comment. If multiple lines are selected, DevTools adds a comment to the start of each lineCommand+/Control+/
Select / de-select the next occurrence of whatever word the cursor is on. Each occurrence is highlighted simultaneouslyCommand+D / Command+UControl+D / Control+U

Network面板

ActionMacWindows / Linux
Start / stop recordingCommand+EControl+E
Record a reloadCommand+RControl+R
Replay a selected XHR requestRR
Hide the details of a selected requestEscapeEscape

Performance面板

ActionMacWindows / Linux
Start / stop recordingCommand+EControl+E
Save recordingCommand+SControl+S
Load recordingCommand+OControl+O

Memory面板

ActionMacWindows / Linux
Start / stop recordingCommand+EControl+E

Console面板

ActionMacWindows / Linux
Accept autocomplete suggestionRight Arrow or TabRight Arrow or Tab
Reject autocomplete suggestionEscapeEscape
Get previous statementUp ArrowUp Arrow
Get next statementDown ArrowDown Arrow
Focus the ConsoleControl+`Control+`
Clear the ConsoleCommand+K or Option+LControl+L
Force a multi-line entry. Note that DevTools should detect multi-line scenarios by default, so this shortcut is now usually unnecessaryShift+ReturnShift+Enter
ExecuteReturnEnter
Expand all sub-properties of an object that's been logged to the ConsoleHold Alt then click ExpandimgHold Alt then click Expand

Search Tab

Search Tab,顾名思义,可以说是搜索的抽屉。

ActionMacWindows / Linux
Expand/collapse all search resultsCommand+Option+Control+Shift+

⌨️推荐文

在网络上找到一些整理的相对较全的,放这里供大家参考。具体如下👇🏻

如有转载或 CV 的请标注本站原文地址