File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -594,7 +594,18 @@ function! GetPythonPEPFormat(lnum, count)
594
594
endif
595
595
elseif l: breakpoint [1 ] > indent (a: lnum )
596
596
call winrestview (l: breakpointview )
597
- call feedkeys (" a\\ \<CR>\<esc> " , ' n' )
597
+
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 )
601
+ " Add a bracket when this is not present yet
602
+ call winrestview (l: breakpointview )
603
+ call feedkeys (" a(\<esc> " , ' n' )
604
+ else
605
+ " Otherwise fall back to a backslash
606
+ call winrestview (l: breakpointview )
607
+ call feedkeys (" a\\ \<CR>\<esc> " , ' n' )
608
+ endif
598
609
else
599
610
call cursor (a: lnum , l: tw + 1 )
600
611
" Search for a space that is not trailing whitespace
You can’t perform that action at this time.
0 commit comments