Skip to content

Commit 77178ce

Browse files
committed
Fix some gq bugs when tw was set
1 parent 357626c commit 77178ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

indent/python.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ endfunction
426426

427427
function! Fixedgq(lnum, count)
428428
let l:count = a:count
429+
430+
if mode() == 'i' " gq was not pressed, but tw was set
431+
return 1
432+
endif
433+
429434
if len(getline(a:lnum)) < 80 && l:count == 1 " No need for gq
430435
return 1
431436
endif
@@ -470,7 +475,7 @@ function! Fixedgq(lnum, count)
470475
endif
471476

472477
" Try breaking after string
473-
if breakpoint[1] == indent(a:lnum)
478+
if breakpoint[1] <= indent(a:lnum)
474479
call cursor(a:lnum, 81)
475480
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_special_chars, a:lnum)
476481
endif

0 commit comments

Comments
 (0)