@@ -563,13 +563,13 @@ function! GetPythonPEPFormat(lnum, count)
563
563
" 2. Breaking inside brackets is preferred (no backslash needed)
564
564
" 3. Breking outside a string is preferred (new breakpoint)
565
565
" 4. Possible future: breaking at space is preferred
566
- if l: breakpoint [0 ] != 0 && s: isBetweenBrackets (l: breakpointview )
566
+ if l: breakpoint [1 ] > indent ( a: lnum ) && s: isBetweenBrackets (l: breakpointview )
567
567
" echom 'between brackets'
568
568
call winrestview (l: breakpointview )
569
569
call feedkeys (" r\<CR> " , ' n' )
570
570
else
571
571
" echom 'zooooi'
572
- if l: better_orig_breakpoint [0 ] != 0
572
+ if l: better_orig_breakpoint [1 ] > indent ( a: lnum )
573
573
\ && s: isBetweenBrackets (l: better_orig_breakpointview )
574
574
" echom 'doing the quotes'
575
575
call winrestview (l: better_orig_breakpointview )
@@ -596,8 +596,10 @@ function! GetPythonPEPFormat(lnum, count)
596
596
call winrestview (l: breakpointview )
597
597
598
598
let l: next_char = getline (a: lnum )[l: breakpoint [1 ]]
599
- if l: next_char !=# ' {' && l: next_char !=# ' (' && l: next_char !=# ' ['
600
- \ && ! s: isBetweenBrackets (l: breakpointview )
599
+ if l: next_char == # ' {' || l: next_char == # ' (' || l: next_char == # ' ['
600
+ " Add a newline after the bracket
601
+ call feedkeys (" la\<CR>\<esc> " , ' n' )
602
+ elseif ! s: isBetweenBrackets (l: breakpointview )
601
603
" Add a bracket when this is not present yet
602
604
call winrestview (l: breakpointview )
603
605
call feedkeys (" a(\<esc> " , ' n' )
0 commit comments