diff --git a/rc/filetype/dhall.kak b/rc/filetype/dhall.kak index 631d9121..a2e0ab94 100644 --- a/rc/filetype/dhall.kak +++ b/rc/filetype/dhall.kak @@ -89,7 +89,7 @@ define-command -hidden dhall-indent-on-new-line %{ # filter previous line try %{ execute-keys -draft k : dhall-trim-indent } # indent after lines ending with let, : or = - try %{ execute-keys -draft \; k x (let|:|=)$ j } + try %{ execute-keys -draft \; k x (\blet|:|=)$ j } } } diff --git a/rc/filetype/elixir.kak b/rc/filetype/elixir.kak index 7e8b1ccc..f5c007a5 100644 --- a/rc/filetype/elixir.kak +++ b/rc/filetype/elixir.kak @@ -98,11 +98,11 @@ define-command -hidden elixir-indent-on-new-line %{ # preserve previous line indent try %{ execute-keys -draft K } # indent after line ending with: - # try %{ execute-keys -draft k x (do|else|->)$ & } + # try %{ execute-keys -draft k x (\bdo|\belse|->)$ & } # filter previous line try %{ execute-keys -draft k : elixir-trim-indent } # indent after lines ending with do or -> - try %{ execute-keys -draft k x ^.+(do|->)$ j } + try %{ execute-keys -draft k x ^.+(\bdo|->)$ j } } } diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index 07d2d8d3..39538cc5 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -58,7 +58,7 @@ define-command -hidden elm-trim-indent %{ } define-command -hidden elm-indent-after " - execute-keys -draft k x ^\\h*(if)|(case\\h+[\\w']+\\h+of|let|in|\\{\\h+\\w+|\\w+\\h+->|[=(])$ j + execute-keys -draft k x ^\\h*if|[=(]$|\\b(case\\h+[\\w']+\\h+of|let|in)$|(\\{\\h+\\w+|\\w+\\h+->)$ j " define-command -hidden elm-indent-on-new-line %{ diff --git a/rc/filetype/fsharp.kak b/rc/filetype/fsharp.kak index 41cde9a4..b34642f3 100644 --- a/rc/filetype/fsharp.kak +++ b/rc/filetype/fsharp.kak @@ -135,7 +135,7 @@ define-command -hidden fsharp-indent-on-new-line %{ # indent after line ending with = try %{ execute-keys -draft k =$ j } # indent after line ending with "do" - try %{ execute-keys -draft k do$ j } + try %{ execute-keys -draft k \bdo$ j } } } diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index d2e23644..4cefbfbc 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -88,7 +88,7 @@ define-command -hidden gluon-indent-on-new-line %~ try %{ execute-keys -draft k : gluon-trim-indent } # indent after lines ending with (open) braces, =, ->, condition, rec, # or in - try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j } + try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|\b(?:then|else|rec|in))$ j } # deindent closing brace(s) when after cursor try %< execute-keys -draft ^\h*[})\]] gh / \})\]] m 1 > _ diff --git a/rc/filetype/haskell.kak b/rc/filetype/haskell.kak index 7d15014a..c86116f0 100644 --- a/rc/filetype/haskell.kak +++ b/rc/filetype/haskell.kak @@ -114,7 +114,7 @@ define-command -hidden haskell-indent-on-new-line %{ # filter previous line 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 } + try %{ execute-keys -draft k x ^\h*if|[=(]$|\b(case\h+[\w']+\h+of|do|let|where)$ j } } } diff --git a/rc/filetype/nim.kak b/rc/filetype/nim.kak index 5795ae35..f398fa23 100644 --- a/rc/filetype/nim.kak +++ b/rc/filetype/nim.kak @@ -117,7 +117,7 @@ def -hidden nim-indent-on-new-line %{ # cleanup trailing whitespaces from previous line try %{ exec -draft k s \h+$ d } # indent after line ending with enum, tuple, object, type, import, export, const, let, var, ':' or '=' - try %{ exec -draft k (:|=|enum|tuple|object|const|let|var|import|export|type)$ j } + try %{ exec -draft k (:|=|\b(?:enum|tuple|object|const|let|var|import|export|type))$ j } } } diff --git a/rc/filetype/pony.kak b/rc/filetype/pony.kak index 535d1976..3357553c 100644 --- a/rc/filetype/pony.kak +++ b/rc/filetype/pony.kak @@ -89,9 +89,9 @@ define-command -hidden pony-indent-on-new-line %{ # copy '//' comment prefix and following white spaces # try %{ execute-keys -draft k x s ^\h*//\h* y jgh P } # indent after line ending with : - try %{ execute-keys -draft k x (do|try|then|else|:|=>)$ j } + try %{ execute-keys -draft k x (\b(?:do|try|then|else)|:|=>)$ j } # else, end are always de-indented - try %{ execute-keys -draft k x (else|end):$ k x s ^\h* y j x ^" J } + try %{ execute-keys -draft k x \b(else|end):$ k x s ^\h* y j x ^" J } } } diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 95e62c53..3f915c5a 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -112,9 +112,9 @@ define-command -hidden sh-indent-on-new-line %[ # done # # indent after do - try %{ execute-keys -draft k do$ j } + try %{ execute-keys -draft k \bdo$ j } # deindent after done - try %{ execute-keys -draft k done$ K j j K } + try %{ execute-keys -draft k \bdone$ K j j K } # Indent if/then/else syntax, e.g.: # if [ $foo = $bar ]; then @@ -132,12 +132,12 @@ define-command -hidden sh-indent-on-new-line %[ # fi # # indent after then - try %{ execute-keys -draft k then$ j } + try %{ execute-keys -draft k \bthen$ j } # deindent after fi - try %{ execute-keys -draft k fi$ K j j K } + try %{ execute-keys -draft k \bfi$ K j j K } # deindent and reindent after else - deindent the else, then back # down and return to the previous indent level. - try %{ execute-keys -draft k else$ j } + try %{ execute-keys -draft k \belse$ j } # Indent case syntax, e.g.: # case "$foo" in @@ -157,9 +157,9 @@ define-command -hidden sh-indent-on-new-line %[ # esac # # indent after in - try %{ execute-keys -draft k in$ j } + try %{ execute-keys -draft k \bin$ j } # deindent after esac - try %{ execute-keys -draft k esac$ j K } + try %{ execute-keys -draft k \besac$ j K } # indent after ) try %{ execute-keys -draft k ^\s*\(?[^(]+[^)]\)$ j } # deindent after ;;