From abe3856d2937f80c169a382d5ea76dda4f405884 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 18 Dec 2014 19:33:57 +0000 Subject: [PATCH] c-family.kak: Just remove trailing indent on InsertEnd --- rc/c-family.kak | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/rc/c-family.kak b/rc/c-family.kak index ff651b71..5d85e57b 100644 --- a/rc/c-family.kak +++ b/rc/c-family.kak @@ -14,8 +14,6 @@ hook global BufSetOption mimetype=text/x-objc %{ set buffer filetype objc } -decl -hidden bool _c_family_last_change_was_indent false - def -hidden _c-family-indent-on-new-line %~ eval -draft -itersel %= # preserve previous line indent @@ -34,7 +32,6 @@ def -hidden _c-family-indent-on-new-line %~ try %[ exec -draft k ^\h*(public|private|protected):\h*$ j ] # indent after if|else|while|for try %[ exec -draft \;)MB \`(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\' s \`|.\' 11 ] - set buffer _c_family_last_change_was_indent true = ~ @@ -89,15 +86,8 @@ addhl -group /objc/code regex "@(property|synthesize|interface|implementation|pr addhl -group /objc/code regex "\<(IBAction|IBOutlet)\>" 0:attribute hook global WinSetOption filetype=(cpp|objc) %[ - hook window BufInsert .* -group c-family-hooks %{ set buffer _c_family_last_change_was_indent false } - hook window BufErase .* -group c-family-hooks %{ set buffer _c_family_last_change_was_indent false } - # cleanup trailing whitespaces when exiting insert mode - hook window InsertEnd .* -group c-family-hooks %{ %sh{ - if [ $kak_opt__c_family_last_change_was_indent = "true" ]; then - echo 'try %{ exec -draft s\h+$d }' - fi - } } + hook window InsertEnd .* -group c-family-hooks %{ try %{ exec -draft s^\h+$d } } hook window InsertChar \n -group c-family-indent _c-family-indent-on-new-line hook window InsertChar \{ -group c-family-indent _c-family-indent-on-opening-curly-brace