diff --git a/rc/core/python.kak b/rc/core/python.kak index 5fa07d0f..37d72e6e 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -57,7 +57,7 @@ def -hidden _python_indent_on_new_line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } - # filter previous line + # cleanup trailing whitespaces from previous line try %{ exec -draft k s \h+$ d } # copy '#' comment prefix and following white spaces try %{ exec -draft k x s ^\h*\K#\h* y j p } @@ -72,6 +72,8 @@ def -hidden _python_indent_on_new_line %{ hook global WinSetOption filetype=python %{ addhl ref python hook window InsertChar \n -group python-indent _python_indent_on_new_line + # cleanup trailing whitespaces on current line insert end + hook window InsertEnd .* -group python-indent %{ try %{ exec -draft \; s ^\h+$ d } } set window formatcmd "autopep8 -" }