summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Laplante via bitbake-devel <bitbake-devel@lists.openembedded.org>2019-10-17 12:36:48 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-28 05:31:42 +0000
commit4bedd3c452991a5f2b22bbae7c2e3185eabca745 (patch)
tree84d3511422fa7e993139438b2a05906220471c06 /bitbake
parentd02c3e4495dc244e93ca38885bc87b1c166c7f82 (diff)
downloadpoky-4bedd3c452991a5f2b22bbae7c2e3185eabca745.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/bitbake/contrib/vim/bitbake.vim44
1 files changed, 27 insertions, 17 deletions
diff --git a/bitbake/bitbake/contrib/vim/bitbake.vim b/bitbake/bitbake/contrib/vim/bitbake.vim
index a210cf5111..ff86c19fac 100644
--- a/bitbake/bitbake/contrib/vim/bitbake.vim
+++ b/bitbake/bitbake/contrib/vim/bitbake.vim
@@ -79,8 +79,14 @@ function GetPythonIndent(lnum)
79 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", 79 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
80 \ searchpair_stopline, searchpair_timeout) 80 \ searchpair_stopline, searchpair_timeout)
81 if parlnum > 0 81 if parlnum > 0
82 let plindent = indent(parlnum) 82 if s:is_python_func_def(parlnum)
83 let plnumstart = parlnum 83 let parlnum = 0
84 let plindent = indent(plnum)
85 let plnumstart = plnum
86 else
87 let plindent = indent(parlnum)
88 let plnumstart = parlnum
89 endif
84 else 90 else
85 let plindent = indent(plnum) 91 let plindent = indent(plnum)
86 let plnumstart = plnum 92 let plnumstart = plnum
@@ -98,22 +104,26 @@ function GetPythonIndent(lnum)
98 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", 104 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
99 \ searchpair_stopline, searchpair_timeout) 105 \ searchpair_stopline, searchpair_timeout)
100 if p > 0 106 if p > 0
101 if p == plnum 107 if s:is_python_func_def(p)
102 " When the start is inside parenthesis, only indent one 'shiftwidth'. 108 let p = 0
103 let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', 109 else
104 \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" 110 if p == plnum
105 \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" 111 " When the start is inside parenthesis, only indent one 'shiftwidth'.
106 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", 112 let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
107 \ searchpair_stopline, searchpair_timeout) 113 \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
108 if pp > 0 114 \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
109 return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) 115 \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
116 \ searchpair_stopline, searchpair_timeout)
117 if pp > 0
118 return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
119 endif
120 return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
121 endif
122 if plnumstart == p
123 return indent(plnum)
124 endif
125 return plindent
110 endif 126 endif
111 return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
112 endif
113 if plnumstart == p
114 return indent(plnum)
115 endif
116 return plindent
117 endif 127 endif
118 128
119 endif 129 endif