简体   繁体   English

如何使用制表符空格键缩进代码?

[英]How do I indent my code with the tab-space key?

For example, how can I type JS some code that looks like this into the Firefox console: 例如,如何在Firefox控制台中向JS输入一些类似于以下代码的代码:

if (10 > 5) { 
    alert("Hello world!");
    alert("How are you doing today?");
    alert("I'm doing great, thanks!")
}

Without resorting to using the space bar or my operating system's clipboard? 是否不使用空格键或操作系统的剪贴板?

I'd like to be able to use the tab key to indent my code in the Firefox console. 我希望能够使用Tab键在Firefox控制台中缩进代码。 Whenever I press tab, Firefox goes through all the elements of the browser and web page without indenting my code. 每当我按下Tab键时,Firefox都会浏览浏览器和网页的所有元素,而不会缩进我的代码。

I'm using the console provided by the Ctrl+Shift+K shortcut. 我正在使用Ctrl+Shift+K快捷键提供的控制台。

You could use the Scratchpad . 您可以使用Scratchpad It is better-designed for multi-line code editing, and supports using the tab character to indent code. 它是为多行代码编辑而设计的,并且支持使用制表符来缩进代码。

便笺

You can find it under the Developer Tools menu. 您可以在“开发工具”菜单下找到它。 Tools > Web Developer > Scratchpad on OS X, and Menu > Developer > Scratchpad on other platforms. 工具 > Web开发 > 便签上的OS X,和菜单 > 开发 > 暂存在其他平台上。

You can also add it to the Toolbox under Toolbox Options (the settings gear), and checking the Scratchpad checkbox. 您也可以将其添加到“工具箱选项” (设置齿轮)下的“ 工具箱”中 ,并选中“ 便签本”复选框。

Can try Shift + Tab (not sure if that will work on firefox, but it works in Chrome) 可以尝试使用Shift + Tab键(不确定是否可以在Firefox中使用,但可以在Chrome中使用)

This probably wont answer your question either but it might.... 这可能也不会回答您的问题,但可能会...。

Editor Preferences 编辑器首选项

Preferences for the CodeMirror source editor, which is included in Firefox and used by several developer tools, including Scratchpad and the Style Editor. CodeMirror源代码编辑器的首选项,包含在Firefox中,并由多个开发人员工具使用,包括Scratchpad和样式编辑器。

Detect indentation: auto-indent new lines based on the current indentation Autoclose brackets Indent using spaces Tab size Keybindings: choose the default CodeMirror keybindings, or keybindings from one of several popular editors: Vim Emacs Sublime Text 检测缩进:根据当前缩进自动缩进新行自动闭合括号使用空格缩进制表符大小键盘绑定:选择默认的CodeMirror键盘绑定,或从几种流行的编辑器之一中选择键盘绑定:Vim Emacs Sublime Text

https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox https://developer.mozilla.org/zh-CN/docs/Tools/Tools_Toolbox

Just indent. 只是缩进。 Control + I. Hahahahaha Control + I.哈哈哈哈哈

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM