From f085e43bf9c9d1fc7da4cd3f1c1b03ac2419d30e Mon Sep 17 00:00:00 2001 From: Olivier Perret Date: Wed, 19 Dec 2018 10:10:26 +0100 Subject: [PATCH] Unify auto-indent trimming hooks * ModeChange hooks that remove indent now belong to *-trim-indent groups, instead of just -indent * *-filter-around-selections hooks and commands have been renamed to trim-indent for clarity --- rc/base/clojure.kak | 4 ++-- rc/base/css.kak | 6 +++--- rc/base/d.kak | 2 +- rc/base/fish.kak | 4 ++-- rc/base/gas.kak | 4 ++-- rc/base/go.kak | 2 +- rc/base/haskell.kak | 6 +++--- rc/base/html.kak | 6 +++--- rc/base/java.kak | 2 +- rc/base/javascript.kak | 6 +++--- rc/base/json.kak | 6 +++--- rc/base/lisp.kak | 4 ++-- rc/base/perl.kak | 2 +- rc/base/ruby.kak | 4 ++-- rc/base/rust.kak | 6 +++--- rc/base/scala.kak | 6 +++--- rc/base/yaml.kak | 6 +++--- rc/core/c-family.kak | 4 ++-- rc/core/kakrc.kak | 2 +- rc/core/makefile.kak | 2 +- rc/core/python.kak | 2 +- rc/extra/cabal.kak | 6 +++--- rc/extra/coffee.kak | 6 +++--- rc/extra/cucumber.kak | 6 +++--- rc/extra/dart.kak | 2 +- rc/extra/elixir.kak | 6 +++--- rc/extra/elm.kak | 6 +++--- rc/extra/haml.kak | 6 +++--- rc/extra/hbs.kak | 9 ++++----- rc/extra/i3.kak | 2 +- rc/extra/moon.kak | 6 +++--- rc/extra/nim.kak | 2 +- rc/extra/php.kak | 6 +++--- rc/extra/pony.kak | 2 +- rc/extra/pug.kak | 6 +++--- rc/extra/ragel.kak | 6 +++--- rc/extra/sass.kak | 6 +++--- rc/extra/scheme.kak | 2 +- rc/extra/scss.kak | 4 ++-- rc/extra/toml.kak | 6 +++--- 40 files changed, 90 insertions(+), 91 deletions(-) diff --git a/rc/base/clojure.kak b/rc/base/clojure.kak index ae6184702..3ee55db7c 100644 --- a/rc/base/clojure.kak +++ b/rc/base/clojure.kak @@ -157,7 +157,7 @@ evaluate-commands %sh{ # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden clojure-filter-around-selections lisp-filter-around-selections +define-command -hidden clojure-trim-indent lisp-trim-indent declare-option \ -docstring 'regex matching the head of forms which have options *and* indented bodies' \ @@ -193,7 +193,7 @@ hook -group clojure-highlight global WinSetOption filetype=clojure %{ } hook global WinSetOption filetype=clojure %[ - hook window ModeChange insert:.* -group clojure-hooks clojure-filter-around-selections + hook window ModeChange insert:.* -group clojure-trim-indent clojure-trim-indent hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window clojure-.+ } diff --git a/rc/base/css.kak b/rc/base/css.kak index a56aef5b0..ecc456ed1 100644 --- a/rc/base/css.kak +++ b/rc/base/css.kak @@ -35,7 +35,7 @@ add-highlighter shared/css/selector/ regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:vari # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden css-filter-around-selections %{ +define-command -hidden css-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -45,7 +45,7 @@ define-command -hidden css-indent-on-new-line %[ # preserve previous line indent try %[ execute-keys -draft \; K ] # filter previous line - try %[ execute-keys -draft k : css-filter-around-selections ] + try %[ execute-keys -draft k : css-trim-indent ] # indent after lines ending with with { try %[ execute-keys -draft k \{$ j ] ] @@ -67,7 +67,7 @@ hook -group css-highlight global WinSetOption filetype=css %{ } hook global WinSetOption filetype=css %[ - hook window ModeChange insert:.* -group css-hooks css-filter-around-selections + hook window ModeChange insert:.* -group css-trim-indent css-trim-indent hook window InsertChar \n -group css-indent css-indent-on-new-line hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace set-option buffer extra_word_chars '_' '-' diff --git a/rc/base/d.kak b/rc/base/d.kak index b0b709f0c..e866865f5 100644 --- a/rc/base/d.kak +++ b/rc/base/d.kak @@ -123,7 +123,7 @@ hook -group d-highlight global WinSetOption filetype=d %{ hook global WinSetOption filetype=d %{ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group d-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group d-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group d-indent d-indent-on-new-line hook window InsertChar \{ -group d-indent d-indent-on-opening-curly-brace hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace diff --git a/rc/base/fish.kak b/rc/base/fish.kak index 3cc02652f..8e23ede43 100644 --- a/rc/base/fish.kak +++ b/rc/base/fish.kak @@ -28,7 +28,7 @@ add-highlighter shared/fish/code/ regex \b(and|begin|bg|bind|block|break|breakpo # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden fish-filter-around-selections %{ +define-command -hidden fish-trim-indent %{ evaluate-commands -no-hooks -draft -itersel %{ # remove trailing white spaces try %{ execute-keys -draft s\h+$d } @@ -49,7 +49,7 @@ define-command -hidden fish-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft K } # filter previous line - try %{ execute-keys -draft k:fish-filter-around-selections } + try %{ execute-keys -draft k:fish-trim-indent } # indent after start structure try %{ execute-keys -draft k^\h*(begin|case|else|for|function|if|switch|while)\bj } } diff --git a/rc/base/gas.kak b/rc/base/gas.kak index 8c3328729..0c1f79f89 100644 --- a/rc/base/gas.kak +++ b/rc/base/gas.kak @@ -61,7 +61,7 @@ add-highlighter shared/gas/code/ regex \ ^\h*(cvttp[ds]2dq|cvttp[ds]2pi|cvtts[ds]2si)\b|\ ^\h*(vxorp[sd]|vandp[sd]|ucomis[sd])\b 0:keyword -define-command -hidden gas-filter-around-selections %{ +define-command -hidden gas-trim-indent %{ evaluate-commands -draft -itersel %{ execute-keys # remove trailing white spaces @@ -74,7 +74,7 @@ define-command -hidden gas-indent-on-new-line %~ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : gas-filter-around-selections } + try %{ execute-keys -draft k : gas-trim-indent } # indent after label try %[ execute-keys -draft k :$ j ] > diff --git a/rc/base/go.kak b/rc/base/go.kak index 17cc9cf03..8aebe657f 100644 --- a/rc/base/go.kak +++ b/rc/base/go.kak @@ -88,7 +88,7 @@ hook -group go-highlight global WinSetOption filetype=go %{ hook global WinSetOption filetype=go %{ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group go-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group go-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group go-indent go-indent-on-new-line hook window InsertChar \{ -group go-indent go-indent-on-opening-curly-brace hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace diff --git a/rc/base/haskell.kak b/rc/base/haskell.kak index f97b62613..c51bcaf41 100644 --- a/rc/base/haskell.kak +++ b/rc/base/haskell.kak @@ -68,7 +68,7 @@ add-highlighter shared/haskell/code/ regex \B'([^\\]|[\\]['"\w\d\\])' 0:string # http://en.wikibooks.org/wiki/Haskell/Indentation -define-command -hidden haskell-filter-around-selections %{ +define-command -hidden haskell-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -82,7 +82,7 @@ define-command -hidden haskell-indent-on-new-line %{ # align to first clause try %{ execute-keys -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* s \A|.\z & } # filter previous line - try %{ execute-keys -draft k : haskell-filter-around-selections } + try %{ execute-keys -draft k : haskell-trim-indent } # indent after lines beginning with condition or ending with expression or =( try %{ execute-keys -draft \; k x ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ j } } @@ -98,7 +98,7 @@ hook -group haskell-highlight global WinSetOption filetype=haskell %{ hook global WinSetOption filetype=haskell %{ set-option window extra_word_chars '_' "'" - hook window ModeChange insert:.* -group haskell-hooks haskell-filter-around-selections + hook window ModeChange insert:.* -group haskell-trim-indent haskell-trim-indent hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haskell-.+ } diff --git a/rc/base/html.kak b/rc/base/html.kak index e1a2a6d91..5f76721da 100644 --- a/rc/base/html.kak +++ b/rc/base/html.kak @@ -32,7 +32,7 @@ add-highlighter shared/html/tag/base/ regex <(!DOCTYPE(\h+\w+)+) 1:meta # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden html-filter-around-selections %{ +define-command -hidden html-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -49,7 +49,7 @@ define-command -hidden html-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : html-filter-around-selections } + try %{ execute-keys -draft k : html-trim-indent } # indent after lines ending with opening tag try %{ execute-keys -draft k (?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ j } } } @@ -65,7 +65,7 @@ hook -group html-highlight global WinSetOption filetype=(html|xml) %{ } hook global WinSetOption filetype=(html|xml) %{ - hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-hooks" html-filter-around-selections + hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent hook window InsertChar '>' -group "%val{hook_param_capture_1}-indent" html-indent-on-greater-than hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" html-indent-on-new-line diff --git a/rc/base/java.kak b/rc/base/java.kak index 75d73c96a..7caa5aee4 100644 --- a/rc/base/java.kak +++ b/rc/base/java.kak @@ -56,7 +56,7 @@ hook -group java-highlight global WinSetOption filetype=java %{ hook global WinSetOption filetype=java %{ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group java-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group java-indent java-indent-on-new-line hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak index 25eef44fc..861958fb0 100644 --- a/rc/base/javascript.kak +++ b/rc/base/javascript.kak @@ -12,7 +12,7 @@ hook global BufCreate .*[.](ts)x? %{ # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden javascript-filter-around-selections %{ +define-command -hidden javascript-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -31,7 +31,7 @@ define-command -hidden javascript-indent-on-new-line %< # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : javascript-filter-around-selections } + try %{ execute-keys -draft k : javascript-trim-indent } # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ > @@ -99,7 +99,7 @@ define-command -hidden init-javascript-filetype -params 1 %~ " hook global WinSetOption "filetype=%arg{1}" " - hook window ModeChange insert:.* -group %arg{1}-hooks javascript-filter-around-selections + hook window ModeChange insert:.* -group %arg{1}-trim-indent javascript-trim-indent hook window InsertChar .* -group %arg{1}-indent javascript-indent-on-char hook window InsertChar \n -group %arg{1}-indent javascript-indent-on-new-line diff --git a/rc/base/json.kak b/rc/base/json.kak index 8acfc01c0..ae04c55ac 100644 --- a/rc/base/json.kak +++ b/rc/base/json.kak @@ -20,7 +20,7 @@ add-highlighter shared/json/code/ regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][ # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden json-filter-around-selections %{ +define-command -hidden json-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -37,7 +37,7 @@ define-command -hidden json-indent-on-new-line %< # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : json-filter-around-selections } + try %{ execute-keys -draft k : json-trim-indent } # indent after lines beginning with opener token try %< execute-keys -draft k ^\h*[[{] j > > @@ -52,7 +52,7 @@ hook -group json-highlight global WinSetOption filetype=json %{ } hook global WinSetOption filetype=json %{ - hook window ModeChange insert:.* -group json-hooks json-filter-around-selections + hook window ModeChange insert:.* -group json-trim-indent json-trim-indent hook window InsertChar .* -group json-indent json-indent-on-char hook window InsertChar \n -group json-indent json-indent-on-new-line diff --git a/rc/base/lisp.kak b/rc/base/lisp.kak index f5ece4fbd..d0ab1d197 100644 --- a/rc/base/lisp.kak +++ b/rc/base/lisp.kak @@ -26,7 +26,7 @@ add-highlighter shared/lisp/code/ regex (\b\d+)?\.\d+([eEsSfFdDlL]\d+)?\b 0:valu # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden lisp-filter-around-selections %{ +define-command -hidden lisp-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -63,7 +63,7 @@ hook -group lisp-highlight global WinSetOption filetype=lisp %{ } hook global WinSetOption filetype=lisp %{ - hook window ModeChange insert:.* -group lisp-hooks lisp-filter-around-selections + hook window ModeChange insert:.* -group lisp-trim-indent lisp-trim-indent hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window lisp-.+ } diff --git a/rc/base/perl.kak b/rc/base/perl.kak index ff2428270..5e5b126a0 100644 --- a/rc/base/perl.kak +++ b/rc/base/perl.kak @@ -105,7 +105,7 @@ hook -group perl-highlight global WinSetOption filetype=perl %{ hook global WinSetOption filetype=perl %{ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group perl-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group perl-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group perl-indent perl-indent-on-new-line hook window InsertChar \{ -group perl-indent perl-indent-on-opening-curly-brace hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace diff --git a/rc/base/ruby.kak b/rc/base/ruby.kak index 1d3cd3e44..1b5bc94f2 100644 --- a/rc/base/ruby.kak +++ b/rc/base/ruby.kak @@ -93,7 +93,7 @@ define-command ruby-alternative-file -docstring 'Jump to the alternate file (imp echo "edit $altfile" }} -define-command -hidden ruby-filter-around-selections %{ +define-command -hidden ruby-trim-indent %{ evaluate-commands -no-hooks -draft -itersel %{ execute-keys # remove trailing white spaces @@ -116,7 +116,7 @@ define-command -hidden ruby-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft K } # filter previous line - try %{ execute-keys -draft k : ruby-filter-around-selections } + try %{ execute-keys -draft k : ruby-trim-indent } # indent after start structure try %{ execute-keys -draft k ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b j } } diff --git a/rc/base/rust.kak b/rc/base/rust.kak index 1b0bc3edb..9cbca8424 100644 --- a/rc/base/rust.kak +++ b/rc/base/rust.kak @@ -37,7 +37,7 @@ add-highlighter shared/rust/code/ regex "('\w+)[^']" 1:meta # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden rust-filter-around-selections %{ +define-command -hidden rust-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -49,7 +49,7 @@ define-command -hidden rust-indent-on-new-line %~ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : rust-filter-around-selections } + try %{ execute-keys -draft k : rust-trim-indent } # indent after lines ending with { or ( try %[ execute-keys -draft k [{(]\h*$ j ] # align to opening paren of previous line @@ -80,7 +80,7 @@ hook -group rust-highlight global WinSetOption filetype=rust %{ } hook global WinSetOption filetype=rust %[ - hook window ModeChange insert:.* -group rust-hooks rust-filter-around-selections + hook window ModeChange insert:.* -group rust-trim-indent rust-trim-indent hook window InsertChar \n -group rust-indent rust-indent-on-new-line hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace hook window InsertChar \} -group rust-indent rust-indent-on-closing-curly-brace diff --git a/rc/base/scala.kak b/rc/base/scala.kak index bdda2498f..1e62e2ada 100644 --- a/rc/base/scala.kak +++ b/rc/base/scala.kak @@ -33,7 +33,7 @@ add-highlighter shared/scala/code/ regex (\[|\]|=>|<:|:>|=:=|::|&&|\|\|) 0:opera # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden scala-filter-around-selections %{ +define-command -hidden scala-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -45,7 +45,7 @@ define-command -hidden scala-indent-on-new-line %[ # preserve previous line indent try %[ execute-keys -draft \; K ] # filter previous line - try %[ execute-keys -draft k : scala-filter-around-selections ] + try %[ execute-keys -draft k : scala-trim-indent ] # indent after lines ending with { try %[ execute-keys -draft k \{$ j ] ] @@ -67,7 +67,7 @@ hook -group scala-highlight global WinSetOption filetype=scala %{ } hook global WinSetOption filetype=scala %[ - hook window ModeChange insert:.* -group scala-hooks scala-filter-around-selections + hook window ModeChange insert:.* -group scala-trim-indent scala-trim-indent hook window InsertChar \n -group scala-indent scala-indent-on-new-line hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace diff --git a/rc/base/yaml.kak b/rc/base/yaml.kak index cff9ab749..7076e13d3 100644 --- a/rc/base/yaml.kak +++ b/rc/base/yaml.kak @@ -25,7 +25,7 @@ add-highlighter shared/yaml/code/ regex ^\h*-?\h*(\S+): 1:attribute # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden yaml-filter-around-selections %{ +define-command -hidden yaml-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -37,7 +37,7 @@ define-command -hidden yaml-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : yaml-filter-around-selections } + try %{ execute-keys -draft k : yaml-trim-indent } # indent after : try %{ execute-keys -draft k x :$ j } } @@ -52,7 +52,7 @@ hook -group yaml-highlight global WinSetOption filetype=yaml %{ } hook global WinSetOption filetype=yaml %{ - hook window ModeChange insert:.* -group yaml-hooks yaml-filter-around-selections + hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ } } diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak index 81c2d3da1..35745043b 100644 --- a/rc/core/c-family.kak +++ b/rc/core/c-family.kak @@ -23,7 +23,7 @@ hook global BufCreate .*\.m %{ set-option buffer filetype objc } -define-command -hidden c-family-trim-autoindent %{ +define-command -hidden c-family-trim-indent %{ # remove the line if it's empty when leaving the insert mode try %{ execute-keys -draft 1s^(\h+)$ d } } @@ -321,7 +321,7 @@ hook global WinSetOption filetype=(c|cpp|objc) %[ hook -group "%val{hook_param_capture_1}-indent" window InsertChar \n c-family-indent-on-newline hook -group "%val{hook_param_capture_1}-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace hook -group "%val{hook_param_capture_1}-indent" window InsertChar \} c-family-indent-on-closing-curly-brace - hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-autoindent + hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-indent hook -group "%val{hook_param_capture_1}-insert" window InsertChar \n c-family-insert-on-newline hook -group "%val{hook_param_capture_1}-insert" window InsertChar \} c-family-insert-on-closing-curly-brace diff --git a/rc/core/kakrc.kak b/rc/core/kakrc.kak index b487d74dc..a765fb7e8 100644 --- a/rc/core/kakrc.kak +++ b/rc/core/kakrc.kak @@ -102,7 +102,7 @@ hook global WinSetOption filetype=kak %~ hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching hook window InsertChar (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char # cleanup trailing whitespaces on current line insert end - hook window ModeChange insert:.* -group kak-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } + hook window ModeChange insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } set-option buffer extra_word_chars '_' '-' hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ } diff --git a/rc/core/makefile.kak b/rc/core/makefile.kak index 0e1b85b39..569d51f97 100644 --- a/rc/core/makefile.kak +++ b/rc/core/makefile.kak @@ -56,5 +56,5 @@ hook -group makefile-highlight global WinSetOption filetype=makefile %{ hook global WinSetOption filetype=makefile %{ hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window makefile-.+ } + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window makefile-.+ } } diff --git a/rc/core/python.kak b/rc/core/python.kak index fac94ae15..fb9477b94 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -143,6 +143,6 @@ hook -group python-highlight global WinSetOption filetype=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 \; s ^\h+$ d } } + hook window ModeChange insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ } } diff --git a/rc/extra/cabal.kak b/rc/extra/cabal.kak index ea15bcc09..b3e7e58c5 100644 --- a/rc/extra/cabal.kak +++ b/rc/extra/cabal.kak @@ -23,7 +23,7 @@ add-highlighter shared/cabal/code/ regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:vari # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden cabal-filter-around-selections %{ +define-command -hidden cabal-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -35,7 +35,7 @@ define-command -hidden cabal-indent-on-new-line %[ # preserve previous line indent try %[ execute-keys -draft \; K ] # filter previous line - try %[ execute-keys -draft k : cabal-filter-around-selections ] + try %[ execute-keys -draft k : cabal-trim-indent ] # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] ] @@ -65,7 +65,7 @@ hook -group cabal-highlight global WinSetOption filetype=cabal %{ } hook global WinSetOption filetype=cabal %[ - hook window ModeChange insert:.* -group cabal-hooks cabal-filter-around-selections + hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace diff --git a/rc/extra/coffee.kak b/rc/extra/coffee.kak index f3447f3d0..c8e7384ea 100644 --- a/rc/extra/coffee.kak +++ b/rc/extra/coffee.kak @@ -42,7 +42,7 @@ add-highlighter shared/coffee/code/ regex \b(break|case|catch|class|const|contin # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden coffee-filter-around-selections %{ +define-command -hidden coffee-trim-indent %{ evaluate-commands -draft -itersel %{ execute-keys # remove trailing white spaces @@ -57,7 +57,7 @@ define-command -hidden coffee-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : coffee-filter-around-selections } + try %{ execute-keys -draft k : coffee-trim-indent } # indent after start structure try %{ execute-keys -draft k ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ j } } @@ -72,7 +72,7 @@ hook -group coffee-highlight global WinSetOption filetype=coffee %{ } hook global WinSetOption filetype=coffee %{ - hook window ModeChange insert:.* -group coffee-hooks coffee-filter-around-selections + hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ } diff --git a/rc/extra/cucumber.kak b/rc/extra/cucumber.kak index 563b3590d..180da7d06 100644 --- a/rc/extra/cucumber.kak +++ b/rc/extra/cucumber.kak @@ -55,7 +55,7 @@ add-highlighter shared/cucumber/code/ regex \b(Feature|Business\h+Need|Ability|B # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden cucumber-filter-around-selections %{ +define-command -hidden cucumber-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -67,7 +67,7 @@ define-command -hidden cucumber-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : cucumber-filter-around-selections } + try %{ execute-keys -draft k : cucumber-trim-indent } # indent after lines containing : try %{ execute-keys -draft k x : j } } @@ -82,7 +82,7 @@ hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ } hook global WinSetOption filetype=cucumber %{ - hook window ModeChange insert:.* -group cucumber-hooks cucumber-filter-around-selections + hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ } diff --git a/rc/extra/dart.kak b/rc/extra/dart.kak index 7618bff41..5b5600cb4 100644 --- a/rc/extra/dart.kak +++ b/rc/extra/dart.kak @@ -97,7 +97,7 @@ hook -group dart-highlight global WinSetOption filetype=dart %{ hook global WinSetOption filetype=dart %{ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group dart-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group dart-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group dart-indent dart-indent-on-new-line hook window InsertChar \{ -group dart-indent dart-indent-on-opening-curly-brace hook window InsertChar \} -group dart-indent dart-indent-on-closing-curly-brace diff --git a/rc/extra/elixir.kak b/rc/extra/elixir.kak index 332901946..a2587d1e8 100644 --- a/rc/extra/elixir.kak +++ b/rc/extra/elixir.kak @@ -41,7 +41,7 @@ add-highlighter shared/elixir/code/ regex '\b\d+[\d_]*\b' 0:value # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden elixir-filter-around-selections %{ +define-command -hidden elixir-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -55,7 +55,7 @@ define-command -hidden elixir-indent-on-new-line %{ # indent after line ending with: # try %{ execute-keys -draft k x (do|else|->)$ & } # filter previous line - try %{ execute-keys -draft k : elixir-filter-around-selections } + try %{ execute-keys -draft k : elixir-trim-indent } # indent after lines ending with do or -> try %{ execute-keys -draft \\; k x ^.+(do|->)$ j } } @@ -70,7 +70,7 @@ hook -group elixir-highlight global WinSetOption filetype=elixir %{ } hook global WinSetOption filetype=elixir %{ - hook window ModeChange insert:.* -group elixir-hooks elixir-filter-around-selections + hook window ModeChange insert:.* -group elixir-trim-indent elixir-trim-indent hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elixir-.+ } diff --git a/rc/extra/elm.kak b/rc/extra/elm.kak index 8b904d6fa..05d1248b4 100644 --- a/rc/extra/elm.kak +++ b/rc/extra/elm.kak @@ -27,7 +27,7 @@ add-highlighter shared/elm/code/ regex \b(Array|Bool|Char|Float|Int|String)\b 0: # http://elm-lang.org/docs/style-guide -define-command -hidden elm-filter-around-selections %{ +define-command -hidden elm-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -45,7 +45,7 @@ define-command -hidden elm-indent-on-new-line %{ # align to first clause try %{ execute-keys -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|let)\h+\K.* s \A|.\z & } # filter previous line - try %{ execute-keys -draft k : elm-filter-around-selections } + try %{ execute-keys -draft k : elm-trim-indent } # indent after lines beginning with condition or ending with expression or =( try %{ elm-indent-after } } @@ -60,7 +60,7 @@ hook -group elm-highlight global WinSetOption filetype=elm %{ } hook global WinSetOption filetype=elm %{ - hook window ModeChange insert:.* -group elm-hooks elm-filter-around-selections + hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent hook window InsertChar \n -group elm-indent elm-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ } diff --git a/rc/extra/haml.kak b/rc/extra/haml.kak index 338895057..e3e7f593f 100644 --- a/rc/extra/haml.kak +++ b/rc/extra/haml.kak @@ -28,7 +28,7 @@ add-highlighter shared/haml/code/ regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za- # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden haml-filter-around-selections %{ +define-command -hidden haml-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -40,7 +40,7 @@ define-command -hidden haml-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : haml-filter-around-selections } + try %{ execute-keys -draft k : haml-trim-indent } # indent after lines beginning with : or - try %{ execute-keys -draft k ^\h*[:-] j } } @@ -55,7 +55,7 @@ hook -group haml-highlight global WinSetOption filetype=haml %{ } hook global WinSetOption filetype=haml %{ - hook window ModeChange insert:.* -group haml-hooks haml-filter-around-selections + hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent hook window InsertChar \n -group haml-indent haml-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ } diff --git a/rc/extra/hbs.kak b/rc/extra/hbs.kak index 22b219bb2..a0948e6f5 100644 --- a/rc/extra/hbs.kak +++ b/rc/extra/hbs.kak @@ -40,7 +40,7 @@ add-highlighter shared/hbs-file/html default-region ref html # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden hbs-filter-around-selections %{ +define-command -hidden hbs-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -59,7 +59,7 @@ define-command -hidden hbs-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : hbs-filter-around-selections } + try %{ execute-keys -draft k : hbs-trim-indent } # indent after lines beginning with : or - try %{ execute-keys -draft k ^\h*[:-] j } } @@ -87,10 +87,9 @@ hook -group hbs-highlight global WinSetOption filetype=hbs %{ } hook global WinSetOption filetype=hbs %{ - hook window ModeChange insert:.* -group hbs-hooks hbs-filter-around-selections + hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line - hook window InsertChar .* -group hbs-ident hbs-indent-on-char - hook window ModeChange insert:.* -group hbs-hooks html-filter-around-selections + hook window InsertChar .* -group hbs-indent hbs-indent-on-char hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than hook window InsertChar \n -group hbs-indent html-indent-on-new-line diff --git a/rc/extra/i3.kak b/rc/extra/i3.kak index 4ec1c5651..84bd7dc92 100644 --- a/rc/extra/i3.kak +++ b/rc/extra/i3.kak @@ -73,7 +73,7 @@ hook -group i3-highlight global WinSetOption filetype=i3 %{ hook global WinSetOption filetype=i3 %[ # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group i3-hooks %{ try %{ execute-keys -draft s^\h+$d } } + hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } hook window InsertChar \n -group i3-indent i3-indent-on-new-line hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace diff --git a/rc/extra/moon.kak b/rc/extra/moon.kak index 6ef83ec73..a1d2ecb80 100644 --- a/rc/extra/moon.kak +++ b/rc/extra/moon.kak @@ -51,7 +51,7 @@ define-command moon-alternative-file -docstring 'Jump to the alternate file (imp printf %s\\n "edit $altfile" }} -define-command -hidden moon-filter-around-selections %{ +define-command -hidden moon-trim-indent %{ evaluate-commands -draft -itersel %{ execute-keys # remove trailing white spaces @@ -77,7 +77,7 @@ define-command -hidden moon-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : moon-filter-around-selections } + try %{ execute-keys -draft k : moon-trim-indent } # indent after start structure try %{ execute-keys -draft k ^ \h * (class|else(if)?|for|if|switch|unless|when|while|with) \b | ([:=]|[-=]>) $ j } # deindent after return statements @@ -94,7 +94,7 @@ hook -group moon-highlight global WinSetOption filetype=moon %{ } hook global WinSetOption filetype=moon %{ - hook window ModeChange insert:.* -group moon-hooks moon-filter-around-selections + hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent hook window InsertChar .* -group moon-indent moon-indent-on-char hook window InsertChar \n -group moon-indent moon-indent-on-new-line diff --git a/rc/extra/nim.kak b/rc/extra/nim.kak index 5b154c667..8ca367339 100644 --- a/rc/extra/nim.kak +++ b/rc/extra/nim.kak @@ -79,7 +79,7 @@ hook -group nim-highlight global WinSetOption filetype=nim %{ hook global WinSetOption filetype=nim %{ hook window InsertChar \n -group nim-indent nim-indent-on-new-line # cleanup trailing whitespaces on current line insert end - hook window ModeChange insert:.* -group nim-indent %{ try %{ exec -draft \; s ^\h+$ d } } + hook window ModeChange insert:.* -group nim-trim-indent %{ try %{ exec -draft \; s ^\h+$ d } } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window nim-.+ } } diff --git a/rc/extra/php.kak b/rc/extra/php.kak index 0186b7bb8..4acfde85e 100644 --- a/rc/extra/php.kak +++ b/rc/extra/php.kak @@ -48,7 +48,7 @@ add-highlighter shared/php-file/php region '<\?(php)?' '\?>' ref php # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden php-filter-around-selections %{ +define-command -hidden php-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -67,7 +67,7 @@ define-command -hidden php-indent-on-new-line %< # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : php-filter-around-selections } + try %{ execute-keys -draft k : php-trim-indent } # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ > @@ -82,7 +82,7 @@ hook -group php-highlight global WinSetOption filetype=php %{ } hook global WinSetOption filetype=php %{ - hook window ModeChange insert:.* -group php-hooks php-filter-around-selections + hook window ModeChange insert:.* -group php-trim-indent php-trim-indent hook window InsertChar .* -group php-indent php-indent-on-char hook window InsertChar \n -group php-indent php-indent-on-new-line diff --git a/rc/extra/pony.kak b/rc/extra/pony.kak index 0266b1949..713cc2951 100644 --- a/rc/extra/pony.kak +++ b/rc/extra/pony.kak @@ -86,7 +86,7 @@ hook -group pony-highlight global WinSetOption filetype=pony %{ hook global WinSetOption filetype=pony %{ hook window InsertChar \n -group pony-indent pony-indent-on-new-line # cleanup trailing whitespaces on current line insert end - hook window ModeChange insert:.* -group pony-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } + hook window ModeChange insert:.* -group pony-trim-indent %{ try %{ execute-keys -draft \; s ^\h+$ d } } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pony-.+ } } diff --git a/rc/extra/pug.kak b/rc/extra/pug.kak index a5921a626..13aa839f0 100644 --- a/rc/extra/pug.kak +++ b/rc/extra/pug.kak @@ -40,7 +40,7 @@ add-highlighter shared/pug/code/ regex ((?:\.[A-Za-z][A-Za-z0-9_-]* # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden pug-filter-around-selections %{ +define-command -hidden pug-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -50,7 +50,7 @@ define-command -hidden pug-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : pug-filter-around-selections } + try %{ execute-keys -draft k : pug-trim-indent } # copy '//', '|', '-' or '(!)=' prefix and following whitespace try %{ execute-keys -draft k s ^\h*\K[/|!=-]{1,2}\h* y gh j P } # indent unless we copied something above @@ -67,7 +67,7 @@ hook -group pug-highlight global WinSetOption filetype=pug %{ } hook global WinSetOption filetype=pug %{ - hook window ModeChange insert:.* -group pug-hooks pug-filter-around-selections + hook window ModeChange insert:.* -group pug-trim-indent pug-trim-indent hook window InsertChar \n -group pug-indent pug-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pug-.+ } diff --git a/rc/extra/ragel.kak b/rc/extra/ragel.kak index 0768d8780..b6e8dd4ca 100644 --- a/rc/extra/ragel.kak +++ b/rc/extra/ragel.kak @@ -27,7 +27,7 @@ add-highlighter shared/ragel/code/ regex \b(action|alnum|alpha|any|ascii|case|cn # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden ragel-filter-around-selections %{ +define-command -hidden ragel-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -47,7 +47,7 @@ define-command -hidden ragel-indent-on-new-line %< # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : ragel-filter-around-selections } + try %{ execute-keys -draft k : ragel-trim-indent } # indent after lines ending with opener token try %< execute-keys -draft k [[{(*]$ j > > @@ -62,7 +62,7 @@ hook -group ragel-highlight global WinSetOption filetype=ragel %{ } hook global WinSetOption filetype=ragel %{ - hook window ModeChange insert:.* -group ragel-hooks ragel-filter-around-selections + hook window ModeChange insert:.* -group ragel-trim-indent ragel-trim-indent hook window InsertChar .* -group ragel-indent ragel-indent-on-char hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line diff --git a/rc/extra/sass.kak b/rc/extra/sass.kak index 5490078fd..d23a7b81f 100644 --- a/rc/extra/sass.kak +++ b/rc/extra/sass.kak @@ -27,7 +27,7 @@ add-highlighter shared/sass/code/ regex !important 0:keyword # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden sass-filter-around-selections %{ +define-command -hidden sass-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -39,7 +39,7 @@ define-command -hidden sass-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : sass-filter-around-selections } + try %{ execute-keys -draft k : sass-trim-indent } # avoid indent after properties and comments try %{ execute-keys -draft k [:/] j } } @@ -54,7 +54,7 @@ hook -group sass-highlight global WinSetOption filetype=sass %{ } hook global WinSetOption filetype=sass %{ - hook window ModeChange insert:.* -group sass-hooks sass-filter-around-selections + hook window ModeChange insert:.* -group sass-trim-indent sass-trim-indent hook window InsertChar \n -group sass-indent sass-indent-on-new-line set-option buffer extra_word_chars '_' '-' diff --git a/rc/extra/scheme.kak b/rc/extra/scheme.kak index b0debf93d..05056a332 100644 --- a/rc/extra/scheme.kak +++ b/rc/extra/scheme.kak @@ -120,7 +120,7 @@ hook -group scheme-highlight global WinSetOption filetype=scheme %{ hook global WinSetOption filetype=scheme %{ set-option buffer extra_word_chars '_' '-' '!' '%' '?' '<' '>' '=' - hook window InsertEnd .* -group scheme-hooks lisp-filter-around-selections + hook window InsertEnd .* -group scheme-trim-indent lisp-trim-indent hook window InsertChar \n -group scheme-indent lisp-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scheme-.+ } diff --git a/rc/extra/scss.kak b/rc/extra/scss.kak index 7fc34abb3..bb720db51 100644 --- a/rc/extra/scss.kak +++ b/rc/extra/scss.kak @@ -23,7 +23,7 @@ add-highlighter shared/scss/core/ regex @[A-Za-z][A-Za-z0-9_-]* 0:meta # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden scss-filter-around-selections css-filter-around-selections +define-command -hidden scss-trim-indent css-trim-indent define-command -hidden scss-indent-on-new-line css-indent-on-new-line define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace @@ -36,7 +36,7 @@ hook -group scss-highlight global WinSetOption filetype=scss %{ } hook global WinSetOption filetype=scss %[ - hook window ModeChange insert:.* -group scss-hooks scss-filter-around-selections + hook window ModeChange insert:.* -group scss-trim-indent scss-trim-indent hook window InsertChar \n -group scss-indent scss-indent-on-new-line hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace set-option buffer extra_word_chars '_' '-' diff --git a/rc/extra/toml.kak b/rc/extra/toml.kak index e68b1f4d0..f95fbb9dd 100644 --- a/rc/extra/toml.kak +++ b/rc/extra/toml.kak @@ -31,7 +31,7 @@ add-highlighter shared/toml/code/ regex \ # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden toml-filter-around-selections %{ +define-command -hidden toml-trim-indent %{ # remove trailing white spaces try %{ execute-keys -draft -itersel s \h+$ d } } @@ -43,7 +43,7 @@ define-command -hidden toml-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line - try %{ execute-keys -draft k : toml-filter-around-selections } + try %{ execute-keys -draft k : toml-trim-indent } } } @@ -56,7 +56,7 @@ hook -group toml-highlight global WinSetOption filetype=toml %{ } hook global WinSetOption filetype=toml %{ - hook window ModeChange insert:.* -group toml-hooks toml-filter-around-selections + hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent hook window InsertChar \n -group toml-indent toml-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ }