gpt4 book ai didi

python - 有没有办法修复 vim 没有注意到 python if 语句有注释?

转载 作者:太空宇宙 更新时间:2023-11-04 06:30:39 25 4
gpt4 key购买 nike

考虑以下代码块-

if (1==1):#Go forever
print "Wooo."

由于注释,Vim 看不到 :, 所以它坚持打印应该与 "if"处于相同的缩进级别

使用 http://www.vim.org/scripts/script.php?script_id=974

如有任何想法,我们将不胜感激。

最佳答案

在 .vim 文件中找到这个:

" If the previous line ended with a colon, indent relative to
" statement start.
if pline =~ ':\s*$'

将其更改为...

" If the previous line ended with a colon, indent relative to
" statement start.
if pline =~ ':\s*\(#.*\)\?$'

这将使它也匹配以冒号结尾且后跟注释的行。

关于python - 有没有办法修复 vim 没有注意到 python if 语句有注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3296104/

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