mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-23 23:34:12 +03:00
Various auto indent fixes regarding wrong use of x instead of <a-x>
This commit is contained in:
parent
fc61ed93e6
commit
91a56c11fe
@ -44,11 +44,11 @@ def -hidden _css_filter_around_selections %{
|
||||
def -hidden _css_indent_on_new_line %[
|
||||
eval -draft -itersel %[
|
||||
# preserve previous line indent
|
||||
try %[ exec -draft <space> K <a-&> ]
|
||||
try %[ exec -draft \; K <a-&> ]
|
||||
# filter previous line
|
||||
try %[ exec -draft k : _css_filter_around_selections <ret> ]
|
||||
# indent after lines ending with with {
|
||||
try %[ exec -draft k x <a-k> \{$ <ret> j <a-gt> ]
|
||||
try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -77,7 +77,7 @@ def -hidden _gas_filter_around_selections %{
|
||||
def -hidden _gas_indent_on_new_line %~
|
||||
eval -draft -itersel %<
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _gas_filter_around_selections <ret> }
|
||||
# indent after label
|
||||
|
@ -39,15 +39,15 @@ def -hidden _haskell_filter_around_selections %{
|
||||
def -hidden _haskell_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy -- comments prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K--\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# align to first clause
|
||||
try %{ exec -draft <space> k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* <ret> s \`|.\' <ret> & }
|
||||
try %{ exec -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* <ret> s \`|.\' <ret> & }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _haskell_filter_around_selections <ret> }
|
||||
# indent after lines beginning with condition or ending with expression or =(
|
||||
try %{ exec -draft <space> k x <a-k> ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ <ret> j <a-gt> }
|
||||
try %{ exec -draft \; k x <a-k> ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ def -hidden _html_indent_on_char %{
|
||||
def -hidden _html_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _html_filter_around_selections <ret> }
|
||||
# indent after lines ending with opening tag
|
||||
try %{ exec -draft k x <a-k> <[^/][^>]+>$ <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> <[^/][^>]+>$ <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,13 +52,13 @@ def -hidden _javascript_indent_on_char %<
|
||||
def -hidden _javascript_indent_on_new_line %<
|
||||
eval -draft -itersel %<
|
||||
# copy // comments prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _javascript_filter_around_selections <ret> }
|
||||
# indent after lines beginning / ending with opener token
|
||||
try %_ exec -draft k x <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
|
||||
try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
|
||||
>
|
||||
>
|
||||
|
||||
|
@ -36,11 +36,11 @@ def -hidden _json_indent_on_char %<
|
||||
def -hidden _json_indent_on_new_line %<
|
||||
eval -draft -itersel %<
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _json_filter_around_selections <ret> }
|
||||
# indent after lines beginning with opener token
|
||||
try %< exec -draft k x <a-k> ^\h*[[{] <ret> j <a-gt> >
|
||||
try %< exec -draft k <a-x> <a-k> ^\h*[[{] <ret> j <a-gt> >
|
||||
>
|
||||
>
|
||||
|
||||
|
@ -34,7 +34,7 @@ def -hidden _lisp_filter_around_selections %{
|
||||
def -hidden _lisp_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# indent when matches opening paren
|
||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> <a-\;> \; <a-gt> }
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ add-highlighter -group /markdown/content regex \H\K\h\h$ 0:PrimarySelection
|
||||
def -hidden _markdown_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy block quote(s), list item prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K((>\h*)|[*+-])+\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K((>\h*)|[*+-])+\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# remove trailing white spaces
|
||||
try %{ exec -draft -itersel %{ k<a-x> s \h+$ <ret> d } }
|
||||
}
|
||||
|
@ -125,18 +125,18 @@ def -hidden _ruby_indent_on_new_line %{
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _ruby_filter_around_selections <ret> }
|
||||
# indent after start structure
|
||||
try %{ exec -draft k x <a-k> ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
def -hidden _ruby_insert_on_new_line %{
|
||||
eval -no-hooks -draft -itersel %{
|
||||
# copy _#_ comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^ \h * \K \# \h * <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P }
|
||||
# wisely add end structure
|
||||
eval -save-regs x %{
|
||||
try %{ exec -draft k x s ^ \h + <ret> \" x y } catch %{ reg x '' }
|
||||
try %{ exec -draft k x <a-k> ^ <c-r> x (begin|case|class|def|do|for|if|module|unless|until|while) <ret> j <a-a> i X <a-\;> K <a-K> ^ <c-r> x (begin|case|class|def|do|for|if|module|unless|until|while) . * \n <c-r> x end $ <ret> j x y p j a end <esc> <a-lt> }
|
||||
try %{ exec -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' }
|
||||
try %{ exec -draft k <a-x> <a-k> ^ <c-r> x (begin|case|class|def|do|for|if|module|unless|until|while) <ret> j <a-a> i X <a-\;> K <a-K> ^ <c-r> x (begin|case|class|def|do|for|if|module|unless|until|while) . * \n <c-r> x end $ <ret> j x y p j a end <esc> <a-lt> }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ def -hidden _rust_filter_around_selections %{
|
||||
def -hidden _rust_indent_on_new_line %~
|
||||
eval -draft -itersel %<
|
||||
# copy // comments prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K//\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K//\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _rust_filter_around_selections <ret> }
|
||||
# indent after lines ending with { or (
|
||||
|
@ -42,13 +42,13 @@ def -hidden _scala_filter_around_selections %{
|
||||
def -hidden _scala_indent_on_new_line %[
|
||||
eval -draft -itersel %[
|
||||
# copy // comments prefix and following white spaces
|
||||
try %[ exec -draft k x s ^\h*\K#\h* <ret> y gh j P ]
|
||||
try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ]
|
||||
# preserve previous line indent
|
||||
try %[ exec -draft <space> K <a-&> ]
|
||||
try %[ exec -draft \; K <a-&> ]
|
||||
# filter previous line
|
||||
try %[ exec -draft k : _scala_filter_around_selections <ret> ]
|
||||
# indent after lines ending with {
|
||||
try %[ exec -draft k x <a-k> \{$ <ret> j <a-gt> ]
|
||||
try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -35,9 +35,9 @@ def -hidden _yaml_filter_around_selections %{
|
||||
def -hidden _yaml_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _yaml_filter_around_selections <ret> }
|
||||
# indent after :
|
||||
|
@ -53,9 +53,9 @@ add-highlighter -group /kakrc/shell ref sh
|
||||
def -hidden kak-indent-on-new-line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*#\h* <ret> y jgh P }
|
||||
try %{ exec -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# cleanup trailing whitespaces from previous line
|
||||
try %{ exec -draft k <a-x> s \h+$ <ret> d }
|
||||
# indent after line ending with %[[:punct:]]
|
||||
|
@ -66,9 +66,9 @@ add-highlighter -group /python/comment fill comment
|
||||
def -hidden python-indent-on-new-line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*#\h* <ret> y jgh P }
|
||||
try %{ exec -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# cleanup trailing whitespaces from previous line
|
||||
try %{ exec -draft k <a-x> s \h+$ <ret> d }
|
||||
# indent after line ending with :
|
||||
|
@ -32,13 +32,13 @@ def -hidden _cabal_filter_around_selections %{
|
||||
def -hidden _cabal_indent_on_new_line %[
|
||||
eval -draft -itersel %[
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %[ exec -draft k x s ^\h*\K#\h* <ret> y gh j P ]
|
||||
try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ]
|
||||
# preserve previous line indent
|
||||
try %[ exec -draft <space> K <a-&> ]
|
||||
try %[ exec -draft \; K <a-&> ]
|
||||
# filter previous line
|
||||
try %[ exec -draft k : _cabal_filter_around_selections <ret> ]
|
||||
# indent after lines ending with { or :
|
||||
try %[ exec -draft <space> k x <a-k> [:{]$ <ret> j <a-gt> ]
|
||||
try %[ exec -draft <space> k <a-x> <a-k> [:{]$ <ret> j <a-gt> ]
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -56,13 +56,13 @@ def -hidden _coffee_filter_around_selections %{
|
||||
def -hidden _coffee_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^ \h * \K \# \h * <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _coffee_filter_around_selections <ret> }
|
||||
# indent after start structure
|
||||
try %{ exec -draft k x <a-k> ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ def -hidden _cucumber_filter_around_selections %{
|
||||
def -hidden _cucumber_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '#' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _cucumber_filter_around_selections <ret> }
|
||||
# indent after lines containing :
|
||||
|
@ -41,13 +41,13 @@ def -hidden _haml_filter_around_selections %{
|
||||
def -hidden _haml_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '/' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K/\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _haml_filter_around_selections <ret> }
|
||||
# indent after lines beginning with : or -
|
||||
try %{ exec -draft k x <a-k> ^\h*[:-] <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,13 +42,13 @@ def -hidden _hbs_filter_around_selections %{
|
||||
def -hidden _hbs_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '/' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K/\h* <ret> y j p }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y j p }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _hbs_filter_around_selections <ret> }
|
||||
# indent after lines beginning with : or -
|
||||
try %{ exec -draft k x <a-k> ^\h*[:-] <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,15 +77,15 @@ def -hidden _moon_indent_on_char %{
|
||||
def -hidden _moon_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy -- comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^ \h * \K -- \h * <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^ \h * \K -- \h * <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _moon_filter_around_selections <ret> }
|
||||
# indent after start structure
|
||||
try %{ exec -draft k x <a-k> ^ \h * (class|else(if)?|for|if|switch|unless|when|while|with) \b | ([:=]|[-=]>) $ <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^ \h * (class|else(if)?|for|if|switch|unless|when|while|with) \b | ([:=]|[-=]>) $ <ret> j <a-gt> }
|
||||
# deindent after return statements
|
||||
try %{ exec -draft k x <a-k> ^ \h * (break|return) \b <ret> j <a-lt> }
|
||||
try %{ exec -draft k <a-x> <a-k> ^ \h * (break|return) \b <ret> j <a-lt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,13 @@ def -hidden _php_indent_on_char %<
|
||||
def -hidden _php_indent_on_new_line %<
|
||||
eval -draft -itersel %<
|
||||
# copy // comments prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _php_filter_around_selections <ret> }
|
||||
# indent after lines beginning / ending with opener token
|
||||
try %_ exec -draft k x <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
|
||||
try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
|
||||
>
|
||||
>
|
||||
|
||||
|
@ -52,11 +52,11 @@ def -hidden _pug_filter_around_selections %{
|
||||
def -hidden _pug_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _pug_filter_around_selections <ret> }
|
||||
# copy '//', '|', '-' or '(!)=' prefix and following whitespace
|
||||
try %{ exec -draft k x s ^\h*\K[/|!=-]{1,2}\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K[/|!=-]{1,2}\h* <ret> y gh j P }
|
||||
# indent unless we copied something above
|
||||
try %{ exec -draft <a-gt> <space> b s \S <ret> g l <a-lt> }
|
||||
}
|
||||
|
@ -45,13 +45,13 @@ def -hidden _ragel_indent_on_char %<
|
||||
def -hidden _ragel_indent_on_new_line %<
|
||||
eval -draft -itersel %<
|
||||
# copy _#_ comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _ragel_filter_around_selections <ret> }
|
||||
# indent after lines ending with opener token
|
||||
try %< exec -draft k x <a-k> [[{(*]$ <ret> j <a-gt> >
|
||||
try %< exec -draft k <a-x> <a-k> [[{(*]$ <ret> j <a-gt> >
|
||||
>
|
||||
>
|
||||
|
||||
|
@ -37,13 +37,13 @@ def -hidden _sass_filter_around_selections %{
|
||||
def -hidden _sass_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
# copy '/' comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K/\h* <ret> y gh j P }
|
||||
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
try %{ exec -draft \; K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _sass_filter_around_selections <ret> }
|
||||
# avoid indent after properties and comments
|
||||
try %{ exec -draft k x <a-K> [:/] <ret> j <a-gt> }
|
||||
try %{ exec -draft k <a-x> <a-K> [:/] <ret> j <a-gt> }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user