Я пытаюсь использовать скрипт отступа 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