summaryrefslogtreecommitdiff
path: root/rc/core/python.kak
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-05 13:59:06 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-05 13:59:06 +0100
commit9298efd19bd024f96df3eab0cef92d03581969ba (patch)
tree901d0a29814e89db33bcbe16411b1136bcc2b619 /rc/core/python.kak
parent8c5d3128ef26c0a99091c72be178c2f267b2f08f (diff)
Restore whitespace cleanup on InsertEnd in python.kak
Diffstat (limited to 'rc/core/python.kak')
-rw-r--r--rc/core/python.kak4
1 files changed, 3 insertions, 1 deletions
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 <space> K <a-&> }
- # filter previous line
+ # cleanup trailing whitespaces from previous line
try %{ exec -draft k <a-x> s \h+$ <ret> d }
# copy '#' comment prefix and following white spaces
try %{ exec -draft k x s ^\h*\K#\h* <ret> 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 \; <a-x> s ^\h+$ <ret> d } }
set window formatcmd "autopep8 -"
}