“ Google” python样式脚本不起作用
|
我正在尝试使用Google python缩进脚本,但不适用于我。我希望它缩进如下:
very_long_function_name(
first_param,
我将其文本粘贴到此vim脚本的末尾:并将其放入~/.vim/indent/python.vim
中。不知道为什么它不起作用。
编辑:固定。
我修改了缩进文件,如下所示:
function GetGooglePythonIndent(lnum)
\" Indent inside parens.
\" Align with the open paren unless it is at the end of the line.
\" E.g.
\" open_paren_not_at_EOL(100,
\" (200,
\" 300),
\" 400)
\" open_paren_at_EOL(
\" 100, 200, 300, 400)
call cursor(a:lnum, 1)
let [par_line, par_col] = searchpairpos(\'(\\|{\\|\\[\', \'\', \')\\|}\\|\\]\', \'bW\',
\\ \"line(\'.\') < \" . (a:lnum - s:maxoff) . \" ? dummy :\"
\\ . \" synIDattr(synID(line(\'.\'), col(\'.\'), 1), \'name\')\"
\\ . \" =~ \'\\\\(Comment\\\\|String\\\\)$\'\")
echo par_line par_col
if par_line > 0
call cursor(par_line, 1)
if par_col != col(\"$\") - 1
return par_col
else
return indent(par_line) + &sw \" FIXED HERE. FIXED BY ADDING THIS LINE
endif
endif
\" Delegate the rest to the original function.
return GetPythonIndent(a:lnum)
endfunction
没有找到相关结果
已邀请:
3 个回复
链眷克袒姜
。
荆怖赡
锯康
,因为内置的python缩进脚本会覆盖我添加到
的脚本。 我可以通过
命令查看加载的订单。