gpt4 book ai didi

VIM 自动缩进不能正常工作

转载 作者:行者123 更新时间:2023-12-04 23:51:59 25 4
gpt4 key购买 nike

在 VIM 中,当我键入 gg=G 自动缩进整个代码时,除了具有以下结构的行外,所有代码都正确缩进:

$my_arr = array(
'a' => 1,
'b' => 2,
)

我已将 shiftwidthtabstop 设置为 2,但它会将数组元素缩进 4 个空格。为什么?

最佳答案

您从未回答有关'indentexpr' 的问题。可能这意味着它是空的。尝试

:set indentexpr=GetPhpIndent()

如果你有,这应该会自动设置

:filetype plugin indent on

在你的 vimrc 文件中。我从中间接得到的

:source $VIMRUNTIME/vimrc_example.vim

:help :filetype
:help :filetype-indent-on
:help php-indent

关于VIM 自动缩进不能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11668014/

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