1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

bitbake: bitbake: contrib/vim: Modify Python indentation to work with 'python do_task {'

(Bitbake rev: cd45a25b2a649e88ddd455bfa3dddc6a60340c03)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chris Laplante via bitbake-devel
2019-10-17 12:36:48 -04:00
committed by Richard Purdie
parent d02c3e4495
commit 4bedd3c452
+27 -17
View File
@@ -79,8 +79,14 @@ function GetPythonIndent(lnum)
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'", \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout) \ searchpair_stopline, searchpair_timeout)
if parlnum > 0 if parlnum > 0
let plindent = indent(parlnum) if s:is_python_func_def(parlnum)
let plnumstart = parlnum let parlnum = 0
let plindent = indent(plnum)
let plnumstart = plnum
else
let plindent = indent(parlnum)
let plnumstart = parlnum
endif
else else
let plindent = indent(plnum) let plindent = indent(plnum)
let plnumstart = plnum let plnumstart = plnum
@@ -98,22 +104,26 @@ function GetPythonIndent(lnum)
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'", \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout) \ searchpair_stopline, searchpair_timeout)
if p > 0 if p > 0
if p == plnum if s:is_python_func_def(p)
" When the start is inside parenthesis, only indent one 'shiftwidth'. let p = 0
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', else
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" if p == plnum
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" " When the start is inside parenthesis, only indent one 'shiftwidth'.
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'", let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
\ searchpair_stopline, searchpair_timeout) \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
if pp > 0 \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if pp > 0
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
endif
return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
endif
if plnumstart == p
return indent(plnum)
endif
return plindent
endif endif
return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
endif
if plnumstart == p
return indent(plnum)
endif
return plindent
endif endif
endif endif