当我在 Vim(使用 MacVim)中编辑一个 python 文件时,我按 o
插入一个新行,Vim 抛出以下错误:
Error detected while processing function <SNR>20_CheckAlign..GetPythonIndent:
line 30:
E121: Undefined variable: dummy
Press ENTER or type command to continue
Error detected while processing function <SNR>20_CheckAlign..GetPythonIndent:
line 30:
E15: Invalid expression: line('.') < 7 ? dummy : synIDattr(synID(line('.'), col('.')
, 1), 'name') =~ '\(Comment\|String\)$'
我该如何解决这个问题?
最佳答案
我发现了问题。只要文件的选项卡设置与编辑器的选项卡设置不同,就会抛出错误。例如,我的 test.py 文件设置为每个选项卡 2 个空格,选项卡扩展为空格,而我的编辑器设置为每个选项卡 4 个空格,没有扩展。
所以解决方案的解决方法是将 Vim 的选项卡设置设置为正在编辑的 python 文件的设置。
关于python - 使用 Vim 编辑 python 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4840851/