问题标签 [auto-indent]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
vim - 让 vim 自动缩进这个语法
我已经成功地让 vim 理解我的语言用于突出显示的语法,但我不确定如何让它自动正确缩进我的代码。该语言本身有点像 Lisp,但它使用方括号[]
和圆括号()
作为分隔符。生成的代码缩进应该是这样的:
基本上,每个未闭合的括号或圆括号应该将行缩进两个空格。关闭所述分隔符应将以下行减少相同的数量。
我已经调查过了autoindent
,但对于我想做的事情似乎还不够,除非我遗漏了一些东西。替代方案 ,indentexpr
似乎更有希望,但我认为我不明白如何使用它。
如何为我的语法获得一个有效的缩进系统?
javascript - Notepad++ 中的自动缩进 HTML / Javascript
所以似乎这个问题在几年前就已经提出过,但似乎没有一个回应适用于最新版本的 Notepad++ 6.2.2
我也尝试过使用 NppAutoIndent 插件无济于事。
intellij-idea - Intellij Idea 代码缩进在评论中令人困惑
当我创建 Java 文件时,我会将 Javadoc 命令作者添加到文件中。Intellij IDEA 还添加了尚未在 Javadoc 中实现的日期和时间作为注释。当我进行自动代码缩进时,它变成了这样:
代替:
如何实现?
visual-studio-2010 - Visual Studio 2010 中的选择性缩进
有没有办法告诉 VS2010在方法内部自动识别行?因为我通常每个文件只有一个命名空间/类,所以我觉得所有这些缩进都是浪费空间。
如果可能的话,我下面的方法命令将在 4 个字符之后开始,而不是在 12 个字符之后。这样我会在我的屏幕上获得 +8 个可见字符(我尝试在 100 个字符后换行)
emacs - Emacs 不会在任何语言中将缩进设置为 4 个空格
我无法让 Emacs 运行并将 Python(或任何环境)设置为 4 空格制表符。以下是我的.emacs
文件,我已经尝试了 下的所有选项;; --- Set python indent to 4 spaces ---
,但都没有奏效。缩进是否可能发生一些冲突或覆盖?
此外,无论我将制表符列表变量设置为 4 的倍数多少次,当我从菜单中使用“自定义 Emacs”并在 .emacs 文件中设置变量时,它们总是以 8 的倍数结束。
我正在为 Mac OS X ( http://emacsformacosx.com/ ) 使用 GNU emacs。
vim - Vim 重新缩进选项
我想将 C 文件从一种编码风格转换为另一种。我可以使用缩进和其他类似的工具。但是,我想知道 Vim 是否有对这种需求的内置支持。
vim - Vim soft wrap with autoindent
In Vim, is there a way to soft wrap the text, autoindent, but also to give the appearance that soft wrapped lines are autoindented?
E.g. rather than:
I want it to look the like the following:
But for the text file in actual fact to be as follows:
So there are no actual tabs (or blocks of 4 spaces) between nine
and ten
or between fifteen
and sixteen
- this is just part of how the text is displayed in Vim, not the contents of the file.
Some other text editors (e.g. Geany) seem to do this automatically, but I can't find out how to do this in Vim.
sublimetext2 - 如何修复/转换 Sublime Text 中的空格缩进?
示例:如果我有一个缩进 2 个空格的文档,并且我希望它具有 4 个空格缩进,如何使用 Sublime Text 编辑器自动转换它?
emacs - Emacs 自动缩进太深
我有一个用于自动缩进文件的保存前挂钩。Emacs 正在插入大量额外的缩进,我该如何解决这个问题?对于具有大量空白的文件类型(Python、Mardown、Stylus),这个问题尤其令人反感。
https://github.com/mcandre/dotfiles/blob/master/emacs
更新:具体来说,(indent-region (point-min) (point-max))
是不正确地缩进我的代码,通过手动应用验证M-: (indent-region (point-min) (point-max))
。
python - 如何自动缩进 python 代码为什么要检测代码..?
我正在对 python 应用程序进行逆向工程。通过它我将通过在应用程序内动态检测代码来观察行为。问题是我需要在正确的缩进级别插入代码。
例如,让我们考虑我将要检测的一段代码:
现在对于上面的示例代码,我将检测进入和退出日志记录,检测代码应该如下所示
这是我在检测代码时需要的,而不是我得到以下信息:
因为我正在编写一个脚本,它插入下一行并且不知道 python 代码的缩进格式。
无论如何我可以在插入时自动调整缩进,或者我应该需要知道下一行中字符的索引并在字符串中插入空格然后插入。