1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-27 12:16:22 +03:00

javascript.kak: Fix indent functions

"..." strings do expand the %{...} strings in them, so
"eval -opt %{haha haha}" is the same as 'eval -opt haha haha'.
This commit is contained in:
Maxime Coste 2015-09-02 13:30:34 +01:00
parent 52c2214391
commit f14f87d2d8

View File

@ -46,15 +46,15 @@ def -hidden _javascript_filter_around_selections %{
} }
} }
def -hidden _javascript_indent_on_char " def -hidden _javascript_indent_on_char %<
eval -draft -itersel %_ eval -draft -itersel %<
# align closer token to its opener when alone on a line # 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-&> / try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> /
_ >
" >
def -hidden _javascript_indent_on_new_line " def -hidden _javascript_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 <space> K <a-&> }
# filter previous line # filter previous line
@ -63,8 +63,8 @@ def -hidden _javascript_indent_on_new_line "
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 / ending with opener token # indent after lines beginning / ending with opener token
try %_ exec -draft k x <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _ try %_ exec -draft k x <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
' >
" >
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾