Merge remote-tracking branch 'alexherbo2/kakrc-fixes'
This commit is contained in:
commit
4a6a02af03
|
@ -47,10 +47,10 @@ def -hidden _javascript_filter_around_selections %{
|
|||
}
|
||||
|
||||
def -hidden _javascript_indent_on_char "
|
||||
eval -draft -itersel '
|
||||
# indent closer token to its opener
|
||||
try %_ exec -draft gh <a-k> ^\h*[]}] <ret> m <a-&> _
|
||||
'
|
||||
eval -draft -itersel %_
|
||||
# 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-&> /
|
||||
_
|
||||
"
|
||||
|
||||
def -hidden _javascript_indent_on_new_line "
|
||||
|
|
|
@ -34,10 +34,10 @@ def -hidden _json_filter_around_selections %{
|
|||
}
|
||||
|
||||
def -hidden _json_indent_on_char "
|
||||
eval -draft -itersel '
|
||||
# indent closer token to its opener
|
||||
try %_ exec -draft gh <a-k> ^\h*[]}] <ret> m <a-&> _
|
||||
'
|
||||
eval -draft -itersel %_
|
||||
# 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-&> /
|
||||
_
|
||||
"
|
||||
|
||||
def -hidden _json_indent_on_new_line "
|
||||
|
|
28
rc/ruby.kak
28
rc/ruby.kak
|
@ -48,7 +48,7 @@ addhl -group /ruby/comment fill comment
|
|||
|
||||
addhl -group /ruby/literal fill meta
|
||||
|
||||
addhl -group /ruby/code regex \<([a-z]\w+:)|([$@][a-z]\w+)|(\W\K:[a-z]\w+[=?!]?) 0:identifier
|
||||
addhl -group /ruby/code regex \<([A-Za-z]\w+:)|([$@][A-Za-z]\w+)|(\W\K:[A-Za-z]\w+[=?!]?) 0:identifier
|
||||
addhl -group /ruby/code regex \<(require|include)\> 0:meta
|
||||
addhl -group /ruby/code regex \<(attr_(reader|writer|accessor))\> 0:attribute
|
||||
|
||||
|
@ -67,27 +67,29 @@ def -hidden _ruby_filter_around_selections %{
|
|||
}
|
||||
}
|
||||
|
||||
def -hidden _ruby_indent_on_char %{
|
||||
eval -draft -itersel %{
|
||||
def -hidden _ruby_indent_on_char "
|
||||
eval -draft -itersel %_
|
||||
# deindent on (else|elsif|end|rescue|when) keyword insertion
|
||||
try %{ exec -draft <space> <a-i>w <a-k> (else|elsif|end|rescue|when) <ret> <a-lt> }
|
||||
}
|
||||
}
|
||||
# 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-&> /
|
||||
_
|
||||
"
|
||||
|
||||
def -hidden _ruby_indent_on_new_line %{
|
||||
eval -draft -itersel %{
|
||||
def -hidden _ruby_indent_on_new_line "
|
||||
eval -draft -itersel '
|
||||
# preserve previous line indent
|
||||
try %{ exec -draft <space> K <a-&> }
|
||||
# filter previous line
|
||||
try %{ exec -draft k : _ruby_filter_around_selections <ret> }
|
||||
# copy '#' comment prefix and following white spaces
|
||||
# copy _#_ comment prefix and following white spaces
|
||||
try %{ exec -draft k x s ^\h*\K#\h* <ret> y j p }
|
||||
# indent after (else|elsif|rescue|when) keywords
|
||||
try %_ exec -draft <space> k x <a-k> (else|elsif|rescue|when) <ret> j <a-gt> _
|
||||
# indent after (begin|case|class|def|do|if|loop|module|unless|until|while) keywords and add 'end' keyword
|
||||
# indent after (else|elsif|rescue|when) keywords and lines beginning / ending with opener token
|
||||
try %_ exec -draft <space> k x <a-k> (else|elsif|rescue|when)|^\h*[[{]|[[{]$ <ret> j <a-gt> _
|
||||
# indent after (begin|case|class|def|do|if|loop|module|unless|until|while) keywords and add _end_ keyword
|
||||
try %{ exec -draft <space> k x <a-k> (begin|case|class|def|do|(?<!els)if|loop|module|unless|until|while) <ret> x y p j a end <esc> k <a-gt> }
|
||||
}
|
||||
}
|
||||
'
|
||||
"
|
||||
|
||||
# Initialization
|
||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
|
Loading…
Reference in New Issue
Block a user