diff options
| author | Olivier Perret <Olivier.Perret@mailbox.org> | 2018-11-28 10:39:07 +0100 |
|---|---|---|
| committer | Olivier Perret <Olivier.Perret@mailbox.org> | 2018-12-11 00:13:30 +0100 |
| commit | 6765723c689467edfa407b95ff86be529ce2983c (patch) | |
| tree | cf0d5ad8acea55fd9d0440c46c355d5bc07adede /rc/core/python.kak | |
| parent | c6f98f84836927d5af269733f8e2833167e7e3e3 (diff) | |
Change cleanup of core/ languages to use a simpler hook -once
Diffstat (limited to 'rc/core/python.kak')
| -rw-r--r-- | rc/core/python.kak | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/rc/core/python.kak b/rc/core/python.kak index a91f0364..8563423d 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -135,16 +135,14 @@ define-command -hidden python-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group python-highlight global WinSetOption filetype=python %{ add-highlighter window/python ref python } +hook -group python-highlight global WinSetOption filetype=python %{ + add-highlighter window/python ref python + hook -once -always window WinSetOption filetype=(?!python).* %{ remove-highlighter window/python } +} hook global WinSetOption filetype=python %{ hook window InsertChar \n -group python-indent python-indent-on-new-line # cleanup trailing whitespaces on current line insert end hook window ModeChange insert:.* -group python-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } } -} - -hook -group python-highlight global WinSetOption filetype=(?!python).* %{ remove-highlighter window/python } - -hook global WinSetOption filetype=(?!python).* %{ - remove-hooks window python-indent + hook -once -always window WinSetOption filetype=(?!python).* %{ remove-hooks window python-.+ } } |
