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

This commit is contained in:
Maxime Coste 2016-02-03 09:29:01 +00:00
commit 3e0e32cfbb

View File

@ -1,6 +1,8 @@
# http://coffeescript.org # http://coffeescript.org
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# require commenting.kak
# Detection # Detection
# ‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾
@ -50,20 +52,23 @@ addhl -group /coffee/code regex \<(break|case|catch|class|const|continue|debugge
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _coffee_filter_around_selections %{ def -hidden _coffee_filter_around_selections %{
eval -draft -itersel %{
exec <a-x>
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft s \h + $ <ret> d }
}
} }
def -hidden _coffee_indent_on_new_line %{ def -hidden _coffee_indent_on_new_line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft <space> K <a-&> } try %{ exec -draft K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _coffee_filter_around_selections <ret> } try %{ exec -draft k : _coffee_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 } try %{ exec -draft k x s ^ \h * \K \# \h * <ret> y j p }
# indent after lines beginning with token and ending with -> # indent after start structure
try %_ exec -draft k x <a-k> ^\h*(case|catch|class|else|finally|for|function|if|switch|try|while|with)|(->)$ <ret> j <a-gt> _ try %{ exec -draft k x <a-k> ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ <ret> j <a-gt> }
} }
} }
@ -75,6 +80,9 @@ hook global WinSetOption filetype=coffee %{
hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections
hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line
set window comment_line_chars '#'
set window comment_selection_chars '###:###'
} }
hook global WinSetOption filetype=(?!coffee).* %{ hook global WinSetOption filetype=(?!coffee).* %{