@@ -53,26 +53,23 @@ endfunction
5353function ! sj#python#JoinDict ()
5454 let line = getline (' .' )
5555
56- if line = ~ ' {\s*$'
57- call search ( ' { ' , ' c ' , line ( ' . ' ))
58- let body = sj#GetMotion ( ' Vi{ ' )
56+ if line ! ~ ' {\s*$'
57+ return 0
58+ endif
5959
60- let lines = sj#TrimList (split (body, " \n " ))
61- if sj#settings#Read (' normalize_whitespace' )
62- let lines = map (lines , ' substitute(v:val, ":\\s\\+", ": ", "")' )
63- endif
60+ call search (' {' , ' c' , line (' .' ))
61+ let body = sj#GetMotion (' Vi{' )
6462
65- let body = join ( lines , ' ' )
66- if sj#settings#Read (' trailing_comma ' )
67- let body = substitute (body , ' ,\?$ ' , ' ' , ' ' )
68- endif
63+ let lines = sj#TrimList ( split (body, " \n " ) )
64+ if sj#settings#Read (' normalize_whitespace ' )
65+ let lines = map ( lines , ' substitute(v:val, ":\\s\\+", ": ", "") ' )
66+ endif
6967
70- call sj#ReplaceMotion (' Va{' , ' {' .body.' }' )
68+ let body = join (lines , ' ' )
69+ let body = substitute (body, ' ,\?$' , ' ' , ' ' )
7170
72- return 1
73- else
74- return 0
75- endif
71+ call sj#ReplaceMotion (' Va{' , ' {' .body.' }' )
72+ return 1
7673endfunction
7774
7875function ! sj#python#SplitArray ()
0 commit comments