Merge remote-tracking branch 'alexherbo2/ruby-rc'

This commit is contained in:
Maxime Coste 2016-09-19 09:26:04 +01:00
commit 80413e1e3a

View File

@ -51,7 +51,7 @@ addhl -group /ruby/comment fill comment
addhl -group /ruby/literal fill meta
addhl -group /ruby/code regex \b([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\w*[=?!]?) 0:identifier
addhl -group /ruby/code regex \b([A-Za-z]\w*:(?=[^:]))|([$@][A-Za-z]\w*)|((?<=[^:]):[A-Za-z]\w*[=?!]?)|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:identifier
%sh{
# Grammar
@ -107,7 +107,7 @@ def ruby-alternative-file -docstring 'Jump to the alternate file (implementation
}}
def -hidden _ruby_filter_around_selections %{
eval -draft -itersel %{
eval -no-hooks -draft -itersel %{
exec <a-x>
# remove trailing white spaces
try %{ exec -draft s \h + $ <ret> d }
@ -115,7 +115,7 @@ def -hidden _ruby_filter_around_selections %{
}
def -hidden _ruby_indent_on_char %{
eval -draft -itersel %{
eval -no-hooks -draft -itersel %{
# 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 * (when) $ <ret> <a-\;> <a-?> ^ \h * (case) <ret> s \A | \Z <ret> \' <a-&> }
@ -125,7 +125,7 @@ def -hidden _ruby_indent_on_char %{
}
def -hidden _ruby_indent_on_new_line %{
eval -draft -itersel %{
eval -no-hooks -draft -itersel %{
# preserve previous line indent
try %{ exec -draft K <a-&> }
# filter previous line
@ -136,13 +136,13 @@ def -hidden _ruby_indent_on_new_line %{
}
def -hidden _ruby_insert_on_new_line %{
eval -draft -itersel %{
eval -no-hooks -draft -itersel %{
# copy _#_ comment prefix and following white spaces
try %{ exec -draft k x s ^ \h * \K \# \h * <ret> y 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 (for|function|if|while) . * \n <c-r> x end $ <ret> j x y p j a end <esc> <a-lt> }
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> }
}
}
}