mirror of
https://github.com/mawww/kakoune.git
synced 2024-09-11 13:00:41 +03:00
rc/: More consistent uses of regex syntax
Always use \A \z for subject start/end, always \b for word boundaries
This commit is contained in:
parent
d5b6669a83
commit
80d661e6a7
@ -17,7 +17,7 @@ def -hidden autowrap-cursor %{ eval -save-regs '/"|^@m' %{
|
|||||||
reg m "%val{selections_desc}"
|
reg m "%val{selections_desc}"
|
||||||
|
|
||||||
## if we're adding characters past the limit, just wrap them around
|
## if we're adding characters past the limit, just wrap them around
|
||||||
exec -draft "<a-h><a-k>.{%opt{autowrap_column}}\h*[^\s]*<ret>1s(\h+)[^\h]*\'<ret>c<ret>"
|
exec -draft "<a-h><a-k>.{%opt{autowrap_column}}\h*[^\s]*<ret>1s(\h+)[^\h]*\z<ret>c<ret>"
|
||||||
} catch %{
|
} catch %{
|
||||||
## if we're adding characters in the middle of a sentence, use
|
## if we're adding characters in the middle of a sentence, use
|
||||||
## the `fmtcmd` command to wrap the entire paragraph
|
## the `fmtcmd` command to wrap the entire paragraph
|
||||||
|
@ -57,7 +57,7 @@ def -hidden css-indent-on-new-line %[
|
|||||||
def -hidden css-indent-on-closing-curly-brace %[
|
def -hidden css-indent-on-closing-curly-brace %[
|
||||||
eval -draft -itersel %[
|
eval -draft -itersel %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -90,24 +90,24 @@ def -hidden d-indent-on-new-line %~
|
|||||||
# cleanup trailing white spaces on the previous line
|
# cleanup trailing white spaces on the previous line
|
||||||
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
||||||
# align to opening paren of previous line
|
# align to opening paren of previous line
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> s \`\(\h*.|.\' <ret> '<a-;>' & }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
|
||||||
# copy // comments prefix
|
# copy // comments prefix
|
||||||
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
||||||
# indent after a switch's case/default statements
|
# indent after a switch's case/default statements
|
||||||
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
||||||
# indent after if|else|while|for
|
# indent after if|else|while|for
|
||||||
try %[ exec -draft \;<a-F>)MB <a-k> \`(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\' <ret> s \`|.\' <ret> 1<a-&>1<a-space><a-gt> ]
|
try %[ exec -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
|
||||||
=
|
=
|
||||||
~
|
~
|
||||||
|
|
||||||
def -hidden d-indent-on-opening-curly-brace %[
|
def -hidden d-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden d-indent-on-closing-curly-brace %[
|
def -hidden d-indent-on-closing-curly-brace %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -39,9 +39,9 @@ def -hidden fish-filter-around-selections %{
|
|||||||
def -hidden fish-indent-on-char %{
|
def -hidden fish-indent-on-char %{
|
||||||
eval -no-hooks -draft -itersel %{
|
eval -no-hooks -draft -itersel %{
|
||||||
# align middle and end structures to start and indent when necessary
|
# align middle and end structures to start and indent when necessary
|
||||||
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> }
|
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\z<ret>'<a-&> }
|
||||||
try %{ exec -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(begin|for|function|if|switch|while)<ret>s\A|\Z<ret>'<a-&> }
|
try %{ exec -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(begin|for|function|if|switch|while)<ret>s\A|\z<ret>'<a-&> }
|
||||||
try %{ exec -draft <a-x><a-k>^\h*(case)$<ret><a-\;><a-?>^\h*(switch)<ret>s\A|\Z<ret>'<a-&>'<space><a-gt> }
|
try %{ exec -draft <a-x><a-k>^\h*(case)$<ret><a-\;><a-?>^\h*(switch)<ret>s\A|\z<ret>'<a-&>'<space><a-gt> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,24 +62,24 @@ def -hidden go-indent-on-new-line %~
|
|||||||
# cleanup trailing white spaces on the previous line
|
# cleanup trailing white spaces on the previous line
|
||||||
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
||||||
# align to opening paren of previous line
|
# align to opening paren of previous line
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> s \`\(\h*.|.\' <ret> '<a-;>' & }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
|
||||||
# copy // comments prefix
|
# copy // comments prefix
|
||||||
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
||||||
# indent after a switch's case/default statements
|
# indent after a switch's case/default statements
|
||||||
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
||||||
# indent after if|else|while|for
|
# indent after if|else|while|for
|
||||||
try %[ exec -draft \;<a-F>)MB <a-k> \`(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\' <ret> s \`|.\' <ret> 1<a-&>1<a-space><a-gt> ]
|
try %[ exec -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
|
||||||
=
|
=
|
||||||
~
|
~
|
||||||
|
|
||||||
def -hidden go-indent-on-opening-curly-brace %[
|
def -hidden go-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden go-indent-on-closing-curly-brace %[
|
def -hidden go-indent-on-closing-curly-brace %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -85,7 +85,7 @@ def -hidden haskell-indent-on-new-line %{
|
|||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ exec -draft \; K <a-&> }
|
try %{ exec -draft \; K <a-&> }
|
||||||
# align to first clause
|
# align to first clause
|
||||||
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> & }
|
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 \A|.\z <ret> & }
|
||||||
# filter previous line
|
# filter previous line
|
||||||
try %{ exec -draft k : haskell-filter-around-selections <ret> }
|
try %{ exec -draft k : haskell-filter-around-selections <ret> }
|
||||||
# indent after lines beginning with condition or ending with expression or =(
|
# indent after lines beginning with condition or ending with expression or =(
|
||||||
|
@ -47,7 +47,7 @@ def -hidden html-filter-around-selections %{
|
|||||||
def -hidden html-indent-on-char %{
|
def -hidden html-indent-on-char %{
|
||||||
eval -draft -itersel %{
|
eval -draft -itersel %{
|
||||||
# align closing tag to opening when alone on a line
|
# align closing tag to opening when alone on a line
|
||||||
try %{ exec -draft <space> <a-h> s ^\h+</(\w+)>$ <ret> <a-\;> <a-?> <lt><c-r>1 <ret> s \`|.\' <ret> <a-r> 1<a-&> }
|
try %{ exec -draft <space> <a-h> s ^\h+</(\w+)>$ <ret> <a-\;> <a-?> <lt><c-r>1 <ret> s \A|.\z <ret> <a-r> 1<a-&> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,24 +27,24 @@ def -hidden java-indent-on-new-line %~
|
|||||||
# cleanup trailing white spaces on the previous line
|
# cleanup trailing white spaces on the previous line
|
||||||
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
||||||
# align to opening paren of previous line
|
# align to opening paren of previous line
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> s \`\(\h*.|.\' <ret> '<a-;>' & }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
|
||||||
# copy // comments prefix
|
# copy // comments prefix
|
||||||
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
||||||
# indent after a switch's case/default statements
|
# indent after a switch's case/default statements
|
||||||
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
||||||
# indent after keywords
|
# indent after keywords
|
||||||
try %[ exec -draft \;<a-F>)MB <a-k> \`(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\' <ret> s \`|.\' <ret> 1<a-&>1<a-space><a-gt> ]
|
try %[ exec -draft \;<a-F>)MB <a-k> \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
|
||||||
=
|
=
|
||||||
~
|
~
|
||||||
|
|
||||||
def -hidden java-indent-on-opening-curly-brace %[
|
def -hidden java-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden java-indent-on-closing-curly-brace %[
|
def -hidden java-indent-on-closing-curly-brace %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -47,7 +47,7 @@ def -hidden javascript-filter-around-selections %{
|
|||||||
def -hidden javascript-indent-on-char %<
|
def -hidden javascript-indent-on-char %<
|
||||||
eval -draft -itersel %<
|
eval -draft -itersel %<
|
||||||
# align closer token to its opener when alone on a line
|
# align closer token to its opener when alone on a line
|
||||||
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> /
|
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \A|.\z <ret> 1<a-&> /
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def -hidden json-filter-around-selections %{
|
|||||||
def -hidden json-indent-on-char %<
|
def -hidden json-indent-on-char %<
|
||||||
eval -draft -itersel %<
|
eval -draft -itersel %<
|
||||||
# align closer token to its opener when alone on a line
|
# align closer token to its opener when alone on a line
|
||||||
try %< exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> >
|
try %< exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \A|.\z <ret> 1<a-&> >
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ def -hidden lisp-indent-on-new-line %{
|
|||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ exec -draft \; K <a-&> }
|
try %{ exec -draft \; K <a-&> }
|
||||||
# indent when matches opening paren
|
# indent when matches opening paren
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> <a-\;> \; <a-gt> }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> <a-\;> \; <a-gt> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ def -hidden lua-filter-around-selections %{
|
|||||||
def -hidden lua-indent-on-char %{
|
def -hidden lua-indent-on-char %{
|
||||||
eval -no-hooks -draft -itersel %{
|
eval -no-hooks -draft -itersel %{
|
||||||
# align middle and end structures to start and indent when necessary, elseif is already covered by else
|
# align middle and end structures to start and indent when necessary, elseif is already covered by else
|
||||||
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> }
|
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\z<ret>'<a-&> }
|
||||||
try %{ exec -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(for|function|if|while)<ret>s\A|\Z<ret>'<a-&> }
|
try %{ exec -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(for|function|if|while)<ret>s\A|\z<ret>'<a-&> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,24 +79,24 @@ def -hidden perl-indent-on-new-line %~
|
|||||||
# cleanup trailing white spaces on the previous line
|
# cleanup trailing white spaces on the previous line
|
||||||
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
||||||
# align to opening paren of previous line
|
# align to opening paren of previous line
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> s \`\(\h*.|.\' <ret> '<a-;>' & }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
|
||||||
# copy // comments prefix
|
# copy // comments prefix
|
||||||
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
try %{ exec -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o><c-o>P<esc> }
|
||||||
# indent after a switch's case/default statements
|
# indent after a switch's case/default statements
|
||||||
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
try %[ exec -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
|
||||||
# indent after if|else|while|for
|
# indent after if|else|while|for
|
||||||
try %[ exec -draft \;<a-F>)MB <a-k> \`(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\' <ret> s \`|.\' <ret> 1<a-&>1<a-space><a-gt> ]
|
try %[ exec -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
|
||||||
=
|
=
|
||||||
~
|
~
|
||||||
|
|
||||||
def -hidden perl-indent-on-opening-curly-brace %[
|
def -hidden perl-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\' <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden perl-indent-on-closing-curly-brace %[
|
def -hidden perl-indent-on-closing-curly-brace %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -111,10 +111,10 @@ def -hidden ruby-filter-around-selections %{
|
|||||||
def -hidden ruby-indent-on-char %{
|
def -hidden ruby-indent-on-char %{
|
||||||
eval -no-hooks -draft -itersel %{
|
eval -no-hooks -draft -itersel %{
|
||||||
# align middle and end structures to start
|
# align middle and end structures to start
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (else|elsif) $ <ret> <a-\;> <a-?> ^ \h * (if) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (else|elsif) $ <ret> <a-\;> <a-?> ^ \h * (if) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-\;> <a-?> ^ \h * (case) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-\;> <a-?> ^ \h * (case) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (rescue) $ <ret> <a-\;> <a-?> ^ \h * (begin) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (rescue) $ <ret> <a-\;> <a-?> ^ \h * (begin) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-\;> <a-?> ^ \h * (begin|case|class|def|do|for|if|module|unless|until|while) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-\;> <a-?> ^ \h * (begin|case|class|def|do|for|if|module|unless|until|while) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,21 +50,21 @@ def -hidden rust-indent-on-new-line %~
|
|||||||
# indent after lines ending with { or (
|
# indent after lines ending with { or (
|
||||||
try %[ exec -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
|
try %[ exec -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
|
||||||
# align to opening paren of previous line
|
# align to opening paren of previous line
|
||||||
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> s \`\(\h*.|.\' <ret> & }
|
try %{ exec -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> & }
|
||||||
>
|
>
|
||||||
~
|
~
|
||||||
|
|
||||||
def -hidden rust-indent-on-opening-curly-brace %[
|
def -hidden rust-indent-on-opening-curly-brace %[
|
||||||
eval -draft -itersel %_
|
eval -draft -itersel %_
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
_
|
_
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden rust-indent-on-closing-curly-brace %[
|
def -hidden rust-indent-on-closing-curly-brace %[
|
||||||
eval -draft -itersel %_
|
eval -draft -itersel %_
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \A|.\z <ret> 1<a-&> ]
|
||||||
_
|
_
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ def -hidden scala-indent-on-new-line %[
|
|||||||
def -hidden scala-indent-on-closing-curly-brace %[
|
def -hidden scala-indent-on-closing-curly-brace %[
|
||||||
eval -draft -itersel %[
|
eval -draft -itersel %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -10,18 +10,18 @@ add-highlighter -group / regions -default code swift \
|
|||||||
add-highlighter -group /swift/string fill string
|
add-highlighter -group /swift/string fill string
|
||||||
add-highlighter -group /swift/comment fill comment
|
add-highlighter -group /swift/comment fill comment
|
||||||
|
|
||||||
add-highlighter -group /swift/comment regex "\<(TODO|XXX|MARK)\>" 0:red
|
add-highlighter -group /swift/comment regex "\b(TODO|XXX|MARK)\b" 0:red
|
||||||
|
|
||||||
add-highlighter -group /swift/code regex %{\<(true|false|nil)\>|\<-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
|
add-highlighter -group /swift/code regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
|
||||||
add-highlighter -group /swift/code regex "\<(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\>" 0:keyword
|
add-highlighter -group /swift/code regex "\b(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\b" 0:keyword
|
||||||
add-highlighter -group /swift/code regex "\<as\>[!?]?" 0:keyword
|
add-highlighter -group /swift/code regex "\bas\b[!?]?" 0:keyword
|
||||||
add-highlighter -group /swift/code regex "(\$[0-9])\>" 0:keyword
|
add-highlighter -group /swift/code regex "(\$[0-9])\b" 0:keyword
|
||||||
add-highlighter -group /swift/code regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\>" 0:attribute
|
add-highlighter -group /swift/code regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute
|
||||||
|
|
||||||
add-highlighter -group /swift/code regex "\<(self|nil|id|super)\>" 0:value
|
add-highlighter -group /swift/code regex "\b(self|nil|id|super)\b" 0:value
|
||||||
add-highlighter -group /swift/code regex "\<(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\>" 0:type
|
add-highlighter -group /swift/code regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
|
||||||
add-highlighter -group /swift/code regex "\<(IBAction|IBOutlet)\>" 0:attribute
|
add-highlighter -group /swift/code regex "\b(IBAction|IBOutlet)\b" 0:attribute
|
||||||
add-highlighter -group /swift/code regex "@\w+\>" 0:attribute
|
add-highlighter -group /swift/code regex "@\w+\b" 0:attribute
|
||||||
|
|
||||||
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter ref swift }
|
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter ref swift }
|
||||||
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter swift }
|
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter swift }
|
||||||
|
@ -32,7 +32,7 @@ def -hidden c-family-indent-on-newline %< eval -draft -itersel %<
|
|||||||
exec \;
|
exec \;
|
||||||
try %<
|
try %<
|
||||||
# if previous line closed a paren, copy indent of the opening paren line
|
# if previous line closed a paren, copy indent of the opening paren line
|
||||||
exec -draft k<a-x> 1s(\))(\h+\w+)*\h*(\;\h*)?$<ret> m<a-\;>J s\`|.\'<ret> 1<a-&>
|
exec -draft k<a-x> 1s(\))(\h+\w+)*\h*(\;\h*)?$<ret> m<a-\;>J s\A|.\z<ret> 1<a-&>
|
||||||
> catch %<
|
> catch %<
|
||||||
# else indent new lines with the same level as the previous one
|
# else indent new lines with the same level as the previous one
|
||||||
exec -draft K <a-&>
|
exec -draft K <a-&>
|
||||||
@ -51,7 +51,7 @@ def -hidden c-family-indent-on-newline %< eval -draft -itersel %<
|
|||||||
# Go to opening parenthesis and opening brace, then select the most nested one
|
# Go to opening parenthesis and opening brace, then select the most nested one
|
||||||
try %< try %< exec [bZ<a-\;>[B<a-z><gt> > catch %< exec [B > >
|
try %< try %< exec [bZ<a-\;>[B<a-z><gt> > catch %< exec [B > >
|
||||||
# Validate selection and get first and last char
|
# Validate selection and get first and last char
|
||||||
exec <a-k>\`[{(](\h*\S+)+\n<ret> <a-:><a-\;>L s\`|.\'<ret>
|
exec <a-k>\A[{(](\h*\S+)+\n<ret> <a-:><a-\;>L s\A|.\z<ret>
|
||||||
# Remove eventual indent from new line
|
# Remove eventual indent from new line
|
||||||
try %< exec -draft <space> <a-h> s\h+<ret> d >
|
try %< exec -draft <space> <a-h> s\h+<ret> d >
|
||||||
# Now align that new line with the opening parenthesis/brace
|
# Now align that new line with the opening parenthesis/brace
|
||||||
@ -61,17 +61,17 @@ def -hidden c-family-indent-on-newline %< eval -draft -itersel %<
|
|||||||
|
|
||||||
def -hidden c-family-indent-on-opening-curly-brace %[
|
def -hidden c-family-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden c-family-indent-on-closing-curly-brace %[
|
def -hidden c-family-indent-on-closing-curly-brace %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -itersel -draft <a-h><a-:><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
try %[ exec -itersel -draft <a-h><a-:><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden c-family-insert-on-closing-curly-brace %[
|
def -hidden c-family-insert-on-closing-curly-brace %[
|
||||||
# add a semicolon after a closing brace if part of a class, union or struct definition
|
# add a semicolon after a closing brace if part of a class, union or struct definition
|
||||||
try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>\`\h*(class|struct|union|enum)<ret> a\;<esc> ]
|
try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>\A\h*(class|struct|union|enum)<ret> a\;<esc> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden c-family-insert-on-newline %[ eval -draft %[
|
def -hidden c-family-insert-on-newline %[ eval -draft %[
|
||||||
@ -94,7 +94,7 @@ def -hidden c-family-insert-on-newline %[ eval -draft %[
|
|||||||
exec -draft k<a-x> <a-k>^(\h*/\*|\h+\*(?!/))<ret>
|
exec -draft k<a-x> <a-k>^(\h*/\*|\h+\*(?!/))<ret>
|
||||||
|
|
||||||
# find comment opening, validate it was not closed, and check its using star prefixes
|
# find comment opening, validate it was not closed, and check its using star prefixes
|
||||||
exec -draft <a-?>/\*<ret><a-H> <a-K>\*/<ret> <a-k>\`\h*/\*([^\n]*\n\h*\*)*[^\n]*\n\h*.\'<ret>
|
exec -draft <a-?>/\*<ret><a-H> <a-K>\*/<ret> <a-k>\A\h*/\*([^\n]*\n\h*\*)*[^\n]*\n\h*.\z<ret>
|
||||||
|
|
||||||
try %[
|
try %[
|
||||||
# if the previous line is opening the comment, insert star preceeded by space
|
# if the previous line is opening the comment, insert star preceeded by space
|
||||||
|
@ -24,7 +24,7 @@ def -hidden -params 1..2 doc-open %{
|
|||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
needle=$(printf %s\\n "$2" | sed 's,<,<lt>,g')
|
needle=$(printf %s\\n "$2" | sed 's,<,<lt>,g')
|
||||||
printf %s\\n "try %{ exec '%<a-s><a-k>(?i)^\h+[^\n]*?\Q${needle}\E<ret>\'' } catch %{ exec <space>gg }"
|
printf %s\\n "try %{ exec '%<a-s><a-k>(?i)^\h+[^\n]*?\Q${needle}\E<ret>\z' } catch %{ exec <space>gg }"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf %s\\n "echo -markup %{{Error}doc '$@' failed: see *debug* buffer for details}"
|
printf %s\\n "echo -markup %{{Error}doc '$@' failed: see *debug* buffer for details}"
|
||||||
|
@ -51,11 +51,11 @@ def -hidden make-jump %{
|
|||||||
try %{
|
try %{
|
||||||
exec gl<a-?> "Entering directory" <ret><a-:>
|
exec gl<a-?> "Entering directory" <ret><a-:>
|
||||||
# Try to parse the error into capture groups, failing on absolute paths
|
# Try to parse the error into capture groups, failing on absolute paths
|
||||||
exec s "Entering directory '([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\'" <ret>l
|
exec s "Entering directory '([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
|
||||||
set buffer make_current_error_line %val{cursor_line}
|
set buffer make_current_error_line %val{cursor_line}
|
||||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -markup %{{Information}%reg{5}}; try %{ focus }"
|
eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -markup %{{Information}%reg{5}}; try %{ focus }"
|
||||||
} catch %{
|
} catch %{
|
||||||
exec <a-h><a-l> s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" <ret>l
|
exec <a-h><a-l> s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
|
||||||
set buffer make_current_error_line %val{cursor_line}
|
set buffer make_current_error_line %val{cursor_line}
|
||||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -markup %{{Information}%reg{4}}; try %{ focus }"
|
eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -markup %{{Information}%reg{4}}; try %{ focus }"
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,14 @@ def -hidden cabal-indent-on-new-line %[
|
|||||||
def -hidden cabal-indent-on-opening-curly-brace %[
|
def -hidden cabal-indent-on-opening-curly-brace %[
|
||||||
eval -draft -itersel %[
|
eval -draft -itersel %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
|
try %[ exec -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
def -hidden cabal-indent-on-closing-curly-brace %[
|
def -hidden cabal-indent-on-closing-curly-brace %[
|
||||||
eval -draft -itersel %[
|
eval -draft -itersel %[
|
||||||
# align to opening curly brace when alone on a line
|
# align to opening curly brace when alone on a line
|
||||||
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\'<ret> 1<a-&> ]
|
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \A|.\z<ret> 1<a-&> ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ def clang-complete -docstring "Complete the current selection" %{ clang-parse -c
|
|||||||
|
|
||||||
def -hidden clang-show-completion-info %[ try %[
|
def -hidden clang-show-completion-info %[ try %[
|
||||||
eval -draft %[
|
eval -draft %[
|
||||||
exec <space>{( <a-k> ^\( <ret> b <a-k> \`\w+\' <ret>
|
exec <space>{( <a-k> ^\( <ret> b <a-k> \A\w+\z <ret>
|
||||||
%sh[
|
%sh[
|
||||||
desc=$(printf %s\\n "${kak_opt_clang_completions}" | sed -e "{ s/\([^\\]\):/\1\n/g }" | sed -ne "/^${kak_selection}|/ { s/^[^|]\+|//; s/|.*$//; s/\\\:/:/g; p }")
|
desc=$(printf %s\\n "${kak_opt_clang_completions}" | sed -e "{ s/\([^\\]\):/\1\n/g }" | sed -ne "/^${kak_selection}|/ { s/^[^|]\+|//; s/|.*$//; s/\\\:/:/g; p }")
|
||||||
if [ -n "$desc" ]; then
|
if [ -n "$desc" ]; then
|
||||||
@ -118,7 +118,7 @@ def clang-enable-autocomplete -docstring "Enable automatic clang completion" %{
|
|||||||
set window completers "option=clang_completions:%opt{completers}"
|
set window completers "option=clang_completions:%opt{completers}"
|
||||||
hook window -group clang-autocomplete InsertIdle .* %{
|
hook window -group clang-autocomplete InsertIdle .* %{
|
||||||
try %{
|
try %{
|
||||||
exec -draft <a-h><a-k>(\.|->|::).\'<ret>
|
exec -draft <a-h><a-k>(\.|->|::).\z<ret>
|
||||||
echo 'completing...'
|
echo 'completing...'
|
||||||
clang-complete
|
clang-complete
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ def -hidden elm-indent-on-new-line %{
|
|||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ exec -draft \; K <a-&> }
|
try %{ exec -draft \; K <a-&> }
|
||||||
# align to first clause
|
# align to first clause
|
||||||
try %{ exec -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|let)\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|let)\h+\K.* <ret> s \A|.\z <ret> & }
|
||||||
# filter previous line
|
# filter previous line
|
||||||
try %{ exec -draft k : elm-filter-around-selections <ret> }
|
try %{ exec -draft k : elm-filter-around-selections <ret> }
|
||||||
# indent after lines beginning with condition or ending with expression or =(
|
# indent after lines beginning with condition or ending with expression or =(
|
||||||
|
@ -12,19 +12,19 @@ hook global BufCreate .*[.](hbs) %{
|
|||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
add-highlighter -group / regions -default html hbs \
|
add-highlighter -group / regions -default html hbs \
|
||||||
comment {{!-- --}} '' \
|
comment \{\{!-- --\}\} '' \
|
||||||
comment {{! }} '' \
|
comment \{\{! \}\} '' \
|
||||||
block-expression {{ }} ''
|
block-expression \{\{ \}\} ''
|
||||||
|
|
||||||
add-highlighter -group /hbs/html ref html
|
add-highlighter -group /hbs/html ref html
|
||||||
add-highlighter -group /hbs/comment fill comment
|
add-highlighter -group /hbs/comment fill comment
|
||||||
add-highlighter -group /hbs/block-expression regex {{((#|/|)(\w|-)+) 1:meta
|
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)(\w|-)+) 1:meta
|
||||||
|
|
||||||
# some hbs tags have a special meaning
|
# some hbs tags have a special meaning
|
||||||
add-highlighter -group /hbs/block-expression regex {{((#|/|)(if|else|unless|with|lookup|log)) 1:keyword
|
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)(if|else|unless|with|lookup|log)) 1:keyword
|
||||||
|
|
||||||
# 'each' is special as it really is two words 'each' and 'as'
|
# 'each' is special as it really is two words 'each' and 'as'
|
||||||
add-highlighter -group /hbs/block-expression regex {{((#|/|)((each).*(as))) 2:keyword 4:keyword 5:keyword
|
add-highlighter -group /hbs/block-expression regex \{\{((#|/|)((each).*(as))) 2:keyword 4:keyword 5:keyword
|
||||||
|
|
||||||
add-highlighter -group /hbs/block-expression regex ((\w|-)+)= 1:attribute
|
add-highlighter -group /hbs/block-expression regex ((\w|-)+)= 1:attribute
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def jedi-complete -docstring "Complete the current selection" %{
|
|||||||
def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the completer" %{
|
def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the completer" %{
|
||||||
set window completers "option=jedi_completions:%opt{completers}"
|
set window completers "option=jedi_completions:%opt{completers}"
|
||||||
hook window -group jedi-autocomplete InsertIdle .* %{ try %{
|
hook window -group jedi-autocomplete InsertIdle .* %{ try %{
|
||||||
exec -draft <a-h><a-k>\..\'<ret>
|
exec -draft <a-h><a-k>\..\z<ret>
|
||||||
echo 'completing...'
|
echo 'completing...'
|
||||||
jedi-complete
|
jedi-complete
|
||||||
} }
|
} }
|
||||||
|
@ -19,9 +19,9 @@ add-highlighter -group /kickstart/double_string fill string
|
|||||||
add-highlighter -group /kickstart/packages regex "^\h*[\w-]*" 0:value
|
add-highlighter -group /kickstart/packages regex "^\h*[\w-]*" 0:value
|
||||||
add-highlighter -group /kickstart/packages regex "#[^\n]*" 0:comment
|
add-highlighter -group /kickstart/packages regex "#[^\n]*" 0:comment
|
||||||
add-highlighter -group /kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute
|
add-highlighter -group /kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute
|
||||||
add-highlighter -group /kickstart/packages regex '\`\h*\K%packages\b' 0:type
|
add-highlighter -group /kickstart/packages regex '\A\h*\K%packages\b' 0:type
|
||||||
add-highlighter -group /kickstart/packages regex '^\h*%end\b' 0:type
|
add-highlighter -group /kickstart/packages regex '^\h*%end\b' 0:type
|
||||||
add-highlighter -group /kickstart/shell regex '\`\h*\K%(pre-install|pre|post)\b' 0:type
|
add-highlighter -group /kickstart/shell regex '\A\h*\K%(pre-install|pre|post)\b' 0:type
|
||||||
add-highlighter -group /kickstart/shell regex '^\h*%end\b' 0:type
|
add-highlighter -group /kickstart/shell regex '^\h*%end\b' 0:type
|
||||||
add-highlighter -group /kickstart/shell ref sh
|
add-highlighter -group /kickstart/shell ref sh
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ def -hidden modeline-parse-impl %{
|
|||||||
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
|
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
|
||||||
def modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
|
def modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
|
||||||
try %{ eval -draft %{
|
try %{ eval -draft %{
|
||||||
exec \%s\`|.\'<ret> %opt{modelines}k <a-x> %opt{modelines}X \
|
exec \%s\A|.\z<ret> %opt{modelines}k <a-x> %opt{modelines}X \
|
||||||
s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
|
s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
|
||||||
eval -draft -itersel modeline-parse-impl
|
eval -draft -itersel modeline-parse-impl
|
||||||
} }
|
} }
|
||||||
|
@ -66,11 +66,11 @@ def -hidden moon-filter-around-selections %{
|
|||||||
def -hidden moon-indent-on-char %{
|
def -hidden moon-indent-on-char %{
|
||||||
eval -draft -itersel %{
|
eval -draft -itersel %{
|
||||||
# align _else_ statements to start
|
# align _else_ statements to start
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (else(if)?) $ <ret> <a-\;> <a-?> ^ \h * (if|unless|when) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (else(if)?) $ <ret> <a-\;> <a-?> ^ \h * (if|unless|when) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
# align _when_ to _switch_ then indent
|
# align _when_ to _switch_ then indent
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-\;> <a-?> ^ \h * (switch) <ret> s \A | \Z <ret> \' <a-&> \' <space> <gt> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-\;> <a-?> ^ \h * (switch) <ret> s \A | \z <ret> \' <a-&> \' <space> <gt> }
|
||||||
# align _catch_ and _finally_ to _try_
|
# align _catch_ and _finally_ to _try_
|
||||||
try %{ exec -draft <a-x> <a-k> ^ \h * (catch|finally) $ <ret> <a-\;> <a-?> ^ \h * (try) <ret> s \A | \Z <ret> \' <a-&> }
|
try %{ exec -draft <a-x> <a-k> ^ \h * (catch|finally) $ <ret> <a-\;> <a-?> ^ \h * (try) <ret> s \A | \z <ret> \' <a-&> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def -hidden php-filter-around-selections %{
|
|||||||
def -hidden php-indent-on-char %<
|
def -hidden php-indent-on-char %<
|
||||||
eval -draft -itersel %<
|
eval -draft -itersel %<
|
||||||
# align closer token to its opener when alone on a line
|
# align closer token to its opener when alone on a line
|
||||||
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> /
|
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \A|.\z <ret> 1<a-&> /
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ def -hidden ragel-filter-around-selections %{
|
|||||||
def -hidden ragel-indent-on-char %<
|
def -hidden ragel-indent-on-char %<
|
||||||
eval -draft -itersel %<
|
eval -draft -itersel %<
|
||||||
# align closer token to its opener when alone on a line
|
# align closer token to its opener when alone on a line
|
||||||
try %< exec -draft <a-h> <a-k> ^\h+[]})]$ <ret> m s \`|.\' <ret> 1<a-&> >
|
try %< exec -draft <a-h> <a-k> ^\h+[]})]$ <ret> m s \A|.\z <ret> 1<a-&> >
|
||||||
try %< exec -draft <a-h> <a-k> ^\h+ [*]$ <ret> <a-?> [*]$ <ret> s \`|.\' <ret> 1<a-&> >
|
try %< exec -draft <a-h> <a-k> ^\h+ [*]$ <ret> <a-?> [*]$ <ret> s \A|.\z <ret> 1<a-&> >
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ add-highlighter -group /tupfile/code regex "\$\([\w_]+\)" 0:value
|
|||||||
add-highlighter -group /tupfile/code regex ":\s*(foreach)\b" 1:keyword
|
add-highlighter -group /tupfile/code regex ":\s*(foreach)\b" 1:keyword
|
||||||
add-highlighter -group /tupfile/code regex "\.gitignore\b" 0:keyword
|
add-highlighter -group /tupfile/code regex "\.gitignore\b" 0:keyword
|
||||||
add-highlighter -group /tupfile/code regex "\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b" 0:keyword
|
add-highlighter -group /tupfile/code regex "\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b" 0:keyword
|
||||||
add-highlighter -group /tupfile/code regex "\b(\&?[\w_]+)\s*[:+]?=" 1:keyword
|
add-highlighter -group /tupfile/code regex "\b(&?[\w_]+)\s*[:+]?=" 1:keyword
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
Loading…
Reference in New Issue
Block a user