From cd656ae4ebc44f9e8f3aea85f9e5dec4cc9b45b3 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Wed, 16 Jul 2014 13:56:40 +0200 Subject: [PATCH 1/3] javascript.kak: fix indent on closer token --- rc/javascript.kak | 8 ++++---- rc/json.kak | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rc/javascript.kak b/rc/javascript.kak index 4592d4db..6ace8dad 100644 --- a/rc/javascript.kak +++ b/rc/javascript.kak @@ -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 ^\h*[]}] m _ - ' + eval -draft -itersel %_ + # align closer token to its opener when alone on a line + try %/ exec -draft ^\h+[]}]$ m s \`|.\' 1 / + _ " def -hidden _javascript_indent_on_new_line " diff --git a/rc/json.kak b/rc/json.kak index f1a32f3b..dcc18db3 100644 --- a/rc/json.kak +++ b/rc/json.kak @@ -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 ^\h*[]}] m _ - ' + eval -draft -itersel %_ + # align closer token to its opener when alone on a line + try %/ exec -draft ^\h+[]}]$ m s \`|.\' 1 / + _ " def -hidden _json_indent_on_new_line " From c4a6f5fa966b45ae88d314886b5fa4fe5333aeaf Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Wed, 16 Jul 2014 13:59:51 +0200 Subject: [PATCH 2/3] ruby.kak: indent on opener / closer tokens --- rc/ruby.kak | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/rc/ruby.kak b/rc/ruby.kak index bb3a26e6..99fecc19 100644 --- a/rc/ruby.kak +++ b/rc/ruby.kak @@ -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 w (else|elsif|end|rescue|when) } - } -} + # align closer token to its opener when alone on a line + try %/ exec -draft ^\h+[]}]$ m s \`|.\' 1 / + _ +" -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 K } # filter previous line try %{ exec -draft k : _ruby_filter_around_selections } - # copy '#' comment prefix and following white spaces + # copy _#_ comment prefix and following white spaces try %{ exec -draft k x s ^\h*\K#\h* y j p } - # indent after (else|elsif|rescue|when) keywords - try %_ exec -draft k x (else|elsif|rescue|when) j _ - # 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 k x (else|elsif|rescue|when)|^\h*[[{]|[[{]$ j _ + # indent after (begin|case|class|def|do|if|loop|module|unless|until|while) keywords and add _end_ keyword try %{ exec -draft k x (begin|case|class|def|do|(? x y p j a end k } - } -} + ' +" # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ From 73ab9cfe71bce27b9df13ed7a1f9735b68ba65c0 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Wed, 16 Jul 2014 14:13:47 +0200 Subject: [PATCH 3/3] ruby.kak: fix identifier highlighting --- rc/ruby.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/ruby.kak b/rc/ruby.kak index 99fecc19..2871de4b 100644 --- a/rc/ruby.kak +++ b/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