Skip to content

Commit e09f1d9

Browse files
committed
Fix some gq bugs when tw was set
1 parent 6a7f996 commit e09f1d9

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
@@ -259,6 +259,11 @@ endfunction
259259

260260
function! Fixedgq(lnum, count)
261261
let l:count = a:count
262+
263+
if mode() == 'i' " gq was not pressed, but tw was set
264+
return 1
265+
endif
266+
262267
if len(getline(a:lnum)) < 80 && l:count == 1 " No need for gq
263268
return 1
264269
endif
@@ -303,7 +308,7 @@ function! Fixedgq(lnum, count)
303308
endif
304309

305310
" Try breaking after string
306-
if breakpoint[1] == indent(a:lnum)
311+
if breakpoint[1] <= indent(a:lnum)
307312
call cursor(a:lnum, 81)
308313
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_special_chars, a:lnum)
309314
endif

0 commit comments

Comments
 (0)