Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 两个括号内的自动缩进-Vim_Function_Vim_Parameters_Indentation_Auto Indent - Fatal编程技术网

Function 两个括号内的自动缩进-Vim

Function 两个括号内的自动缩进-Vim,function,vim,parameters,indentation,auto-indent,Function,Vim,Parameters,Indentation,Auto Indent,我希望vim像这样自动缩进 int function_that_takes_long_arguments(long_argument_1,| ^ This is the cursor. 按回车键 int function_that_takes_long_arguments(long_argume

我希望vim像这样自动缩进

int function_that_takes_long_arguments(long_argument_1,|
                                                       ^
                                              This is the cursor.
按回车键

int function_that_takes_long_arguments(long_argument_1,<enter>
>   >   >   >   >   >   >   >   >   ...|);
    ^                                ^ ^
(tab - 4 spaces)                     | |
                 (Add spaces to align) |
                      (I want the cursor to auto indent here)
取长参数的int函数(长参数1, > > > > > > > > > ...|); ^ ^ ^ (表4空格)|| (添加要对齐的空格)| (我希望光标在此自动缩进) 开始编写其他参数

int function_that_takes_long_arguments(long_argument_1,<enter>
>   >   >   >   >   >   >   >   >   ...long_argument_2,<enter>
>   >   >   >   >   >   >   >   >   ...long_argument_3);
取长参数的int函数(长参数1, >>>>>>>>>>>…长参数2, >>>>>>>>>>…长参数(3); 另一个例子:

void function(argument_1, argument_2, argument_3,<enter>
>   >   >   ..argument_4, argument_5);
void函数(参数_1、参数_2、参数_3、,
>>>…论点4,论点5);

C/C++文件中的缩进通常由内部例程管理(另请参见
:h C-Indenting
)。支持的选项在
:h cinoptions values
下有详细说明

因此,假设您在当前缓冲区中有
setlocal cindent
(只包括
filetype-indent-on
,它会自动为一些文件类型/扩展设置
cindent
),这就足够了

~.vim/after/indent/c.vim


嗯,我也会对一个有效的解决方案感兴趣(我认为这是可能的,但并不容易)。然而,我确实通过使用一个可以纠正这个问题的过梁来解决这个问题(在我的例子中,rubocp具有自动更正功能)。也许也有适合你的东西。
setlocal cinoptions=(0