diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 6ef7def5e..658ba9c3b 100644 --- a/rc/filetype/ruby.kak +++ b/rc/filetype/ruby.kak @@ -86,7 +86,7 @@ evaluate-commands %sh{ # Highlight keywords printf %s " - add-highlighter shared/ruby/code/ regex \b(${keywords})\b 0:keyword + add-highlighter shared/ruby/code/ regex \b(${keywords})[^0-9A-Za-z_!?] 1:keyword add-highlighter shared/ruby/code/ regex \b(${attributes})\b 0:attribute add-highlighter shared/ruby/code/ regex \b(${values})\b 0:value add-highlighter shared/ruby/code/ regex \b(${meta})\b 0:meta @@ -153,7 +153,7 @@ define-command -hidden ruby-indent-on-new-line %{ # filter previous line try %{ execute-keys -draft k : ruby-trim-indent } # indent after start structure - try %{ execute-keys -draft k ^ \h * (begin|case|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|.+\bdo$|.+\bdo\h\|.+(?=\|)) \b j } + try %{ execute-keys -draft k ^ \h * (begin|case|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|.+\bdo$|.+\bdo\h\|.+(?=\|)) [^0-9A-Za-z_!?] j } } } @@ -167,9 +167,9 @@ define-command -hidden ruby-insert-on-new-line %[ try %[ evaluate-commands -draft %[ # Check if previous line opens a block - execute-keys -draft k ^x(begin|case|class|def|for|if|module|unless|until|while|.+\bdo$|.+\bdo\h\|.+(?=\|))\b + execute-keys -draft k ^x(begin|case|class|def|for|if|module|unless|until|while|.+\bdo$|.+\bdo\h\|.+(?=\|))[^0-9A-Za-z_!?] # Check that we do not already have an end for this indent level which is first set via `ruby-indent-on-new-line` hook - execute-keys -draft }i J ^x(end|else|elsif|rescue)\b + execute-keys -draft }i J ^x(end|else|elsif|rescue)[^0-9A-Za-z_!?] ] execute-keys -draft oxend # insert a new line with containing end ]