gpt4 book ai didi

vim - 使用 vim 排列函数参数列表

转载 作者:行者123 更新时间:2023-12-02 17:29:55 27 4
gpt4 key购买 nike

当定义或调用具有足够参数的函数来跨越多行时,我希望 vim 将它们排列起来。例如,

def myfunction(arg1, arg2, arg, ...
argsN-1, argN)

这个想法是让 argsN-1 的“a”与 args1 对齐。

有谁有办法在 vim 中自动发生这种情况吗?我见过用于排列等号(在赋值语句中)等的对齐插件,但我不确定是否可以解决这个问题?

最佳答案

上一个海报有它,但忘记了设置

:set cino=(0<Enter>

来自:help cinoptions-values

The 'cinoptions' option sets how Vim performs indentation.  In the list below,
"N" represents a number of your choice (the number can be negative). When
there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
"1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
decimal point, too: "-0.5s" is minus half a 'shiftwidth'. The examples below
assume a 'shiftwidth' of 4.

...

(N When in unclosed parentheses, indent N characters from the line
with the unclosed parentheses. Add a 'shiftwidth' for every
unclosed parentheses. When N is 0 or the unclosed parentheses
is the first non-white character in its line, line up with the
next non-white character after the unclosed parentheses.
(default 'shiftwidth' * 2).

cino= cino=(0 >
if (c1 && (c2 || if (c1 && (c2 ||
c3)) c3))
foo; foo;
if (c1 && if (c1 &&
(c2 || c3)) (c2 || c3))
{ {

关于vim - 使用 vim 排列函数参数列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/88931/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com