标签: auto-indent

Xcode禁用冒号对齐自动缩进

是否有任何方法可以禁用自动缩进Xcode执行以在将长方法名称分成多行时对齐冒号?

也就是说,我宁愿没有这个:

UIBarButtonItem *longDescriptiveButton = [[UIBarButtonItem alloc] initWithTitle:@"Title of Button"
                                                                          style:UIBarButtonItemStyleBordered
                                                                         target:self
                                                                         action:@selector(longDescriptiveButtonClicked)];
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,当变量/方法/类名称很长时,它看起来很糟糕.

xcode auto-indent

5
推荐指数
1
解决办法
1168
查看次数

如何在vim中修复损坏的自动缩进

我试图使用vim 7.2(在Windows XP上)自动缩进和格式化一些VHDL和Matlab代码.为此,我尝试使用"gg = G"命令.但是这不能正常工作.代码没有正确缩进.

举个例子,我有以下源代码,它已经正确缩进:

% This function is based on the code_g_generator() function
function [v_code] = get_code(n_code_number)
% There is no need to clear the persistent variables in this function
mlock 
%% Initialize the internal variables
persistent n_fifo_top;
if isempty(n_fifo_top)
    n_fifo_top = 1;
end

N_MEMORY_SIZE = 4;
if n_code_number > 4
    c_saved_code_fifo = {-1*ones(1, N_MEMORY_SIZE)};
end
Run Code Online (Sandbox Code Playgroud)

如果我使用"gg = G"命令,我得到:

% This function is based on the code_g_generator() function
function [v_code] = get_code(n_code_number)
% There is no need to …
Run Code Online (Sandbox Code Playgroud)

vim code-formatting indentation auto-indent

5
推荐指数
1
解决办法
3260
查看次数

记事本++和nppautoindent

我已将 nppautoindent 插件安装到 notepad++ 编辑器中。我看不到自动缩进效果。我正在使用 PHP。有人可以帮我解决这个问题吗?

谢谢

notepad++ indentation auto-indent

5
推荐指数
1
解决办法
8530
查看次数

用于缩进PHP文件的命令行程序

我正在寻找一个缩进应用程序来修复PHP代码格式的所有方面 - 转换空格,在PHP和HTML代码中执行缩进,单独留下HEREDOC等.

请为PHP推荐一款不错的压头.

php indentation auto-indent

5
推荐指数
2
解决办法
4269
查看次数

如何强制SublimeText 2使用4个空格标签?(有时会改为空格)

SublimeText 2通常会打开文件,如果它在某个地方找到一些空格而不是标签.

我说要强制一切到4个标签.不要手动转换我打开到标签的每个文件(比如如何用Sublime Text 2中的标签替换四个空格?)

有时我有一个带有4个空格的缩进缩进的文档,当我按Tab键时,它会写入4个空格!

"detect_indentation": false,
"translate_tabs_to_spaces": false
Run Code Online (Sandbox Code Playgroud)

(做tab_completion = true有帮助)

indentation auto-indent sublimetext2

5
推荐指数
1
解决办法
3562
查看次数

如何为有文化的Haskell编程设置vim的标识?

当我打开autoindent常规的*.hs文件时,按下后输入新行按预期缩进.但是,这不适用于代码行以(AKA"bird-tracks")开头的文字Haskell*.lhs文件>.光标始终位于第一列.

我如何设置vim,以便当我在*.lhs文件中的一段代码中(并且让它们autoindent开启)时,按Enter键会在新行创建一个鸟类轨道并适当缩进?

更新:举个例子,让我们说有

> myfn x | x <= 0     = 0
>        | x == 1     = 1?
Run Code Online (Sandbox Code Playgroud)

where ?表示光标的位置(我希望你看到unicode字符没有问题.)如果按Enter键,我最终会

> myfn x | x <= 0     = 0
>        | x == 1     = 1
?
Run Code Online (Sandbox Code Playgroud)

而我想要

> myfn x | x <= 0     = 0
>        | x == 1     = 1
>        ?
Run Code Online (Sandbox Code Playgroud)

vim haskell indentation literate-programming auto-indent

5
推荐指数
1
解决办法
532
查看次数

如何让 Vim 自动缩进以在新行上保持缩进

set autoindent我的 .vimrc 中有

假设我在 Vim 的插入模式下位于缩进线上。如果我通过按 Enter 键创建一堆新行,它会让我的光标保持缩进。但是,我当前行和原始行之间的行失去了缩进。Notepad++ 不会出现这种情况

|表示空行上的缩进。

维姆:

function f()
{
    var x;
|
|
|
    |//cursor
Run Code Online (Sandbox Code Playgroud)

记事本++:

function f()
{
    var x;
    |
    |
    |
    |//cursor
Run Code Online (Sandbox Code Playgroud)

如何让 Vim 表现得像 Notepad++?

vim notepad++ auto-indent

5
推荐指数
1
解决办法
2275
查看次数

Intellij 格式化程序链式方法调用

如何强制 IntellJ 代码格式化程序在与包装的链式方法调用不同的级别上自动缩进包装的参数列表:

编辑:有关更好的问题描述,请参阅更新的示例。如果我将每个连续的方法调用包装到一个新行,默认格式化程序会按预期工作。只有当我想每行留下一个或多个点时才会出现问题:

包装这个:

new Something()
    .chained("arg1", "arg2", "very long arg I want to see in new line")
    .chained("arg1", "arg2", "very long arg I want to see in new line")
    .extra().chained("arg1", "arg2", "very long arg I want to see in new line")
    .extra().chained("arg1", "arg2", "very long arg I want to see in new line");
Run Code Online (Sandbox Code Playgroud)

我希望是这样的:

new Something()
    .chained("arg1", "arg2", 
        "very long arg I want to see in new line")
    .chained("arg1", "arg2", 
        "very long arg I want to see …
Run Code Online (Sandbox Code Playgroud)

java code-formatting intellij-idea auto-indent

5
推荐指数
1
解决办法
2022
查看次数

自动缩进:smartindent 和 indentexpr

当我编辑 Python 文件时,例如:

def my_func():
    print('Something')
    <-- CURSOR IS HERE
Run Code Online (Sandbox Code Playgroud)

我想通过输入 a 添加注释#,该行会自动重新缩进到该行的开头:

def my_func():
    print('Something')
#<-- CURSOR IS HERE
Run Code Online (Sandbox Code Playgroud)

我发现这是该smartindent选项的影响,因此要修复它,我只需运行:set nosi(或在我的 .vimrc 中禁用它)。

但在 Vim 的帮助中,:h 'smartindent'您可以阅读以下内容:

当 'cindent' 打开或设置 'indentexpr' 时,设置 'si' 无效。

但我的indentexpr选项设置如下:

:set indentexpr?
indentexpr=GetPythonIndent(v:lnum)
Run Code Online (Sandbox Code Playgroud)

我当然应该完全避免使用smartindent选项,因为它看起来是一个旧功能,并且仅设计用于 C 风格语言;

但我想知道,smartindent考虑到帮助中写的内容,为什么在编辑 python 文件时会产生一些影响?

vim auto-indent

5
推荐指数
1
解决办法
4451
查看次数

在 VSCode 中,哪个命令会自动缩进当前行?

我读过这篇关于自动格式化代码的文章,它在格式化一些 JSON 时起作用。似乎一次性格式化了整个文件。这可能有点激烈,例如,如果 VS Code 使用的缩进规则与项目冲突,则在大文件上使用时将导致主要版本控制差异。如何自动缩进当前行?

在 Emacs 中,光标可以位于行上的任何位置,按Ctrl+i将自动缩进当前行。我搜索了可能的键盘快捷键,但没有找到可以执行此操作的键盘快捷键。我正在寻找类似“缩进线”的东西,但要自动缩进。

auto-indent visual-studio-code

5
推荐指数
1
解决办法
1072
查看次数